pear problem

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
prakashadmane
Forum Commoner
Posts: 33
Joined: Thu Mar 01, 2007 1:53 am
Location: mumbai,india
Contact:

pear problem

Post by prakashadmane »

i install pear


but i faces problem

plz help me .

Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\peartest.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;c:\php\includes;C:\php\PEAR') in c:\Inetpub\wwwroot\peartest.php on line 3
flann
Forum Commoner
Posts: 38
Joined: Tue Aug 23, 2005 10:48 pm

Post by flann »

in the shell type the following.

pear install DB

once that is ran you'll be able to work with the pear DB
prakashadmane
Forum Commoner
Posts: 33
Joined: Thu Mar 01, 2007 1:53 am
Location: mumbai,india
Contact:

Post by prakashadmane »

PEAR is an extension for PHP. These days PEAR is included with PHP, but you need to install it yourself. I use PEAR on all my PHP developments.

Ok.. Installing PEAR isn’t bad, here is what you do:

Open a command line window (i.e. Start->Run->cmd)
Go to the PHP directory, in my case C:\php. Type go-pear.bat. Follow the instructions.
The PEAR extension get installed in C:\php\PEAR directory.
Once PEAR is installed, go to the php.ini file in your Apache2 directory. Find the

Code:


;include_path = ".;c:\php\includes"

Remove the semi-colon (to un-comment it), and then add C:\php\PEAR to it

Code:


include_path = ".;c:\php\includes;C:\php\PEAR"



i use this manual to pear install . plz help bi=ut till i face problem

Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in c:\Inetpub\wwwroot\peartest.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;c:\php\includes;C:\php\PEAR') in c:\Inetpub\wwwroot\peartest.php on line 3
flann
Forum Commoner
Posts: 38
Joined: Tue Aug 23, 2005 10:48 pm

Post by flann »

I know that pear is an extension for PHP, but the DB class doesn't install by default. You have to use the pear installer to install it.


The command to install it is...

pear install DB
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Did you restart the server?
prakashadmane
Forum Commoner
Posts: 33
Joined: Thu Mar 01, 2007 1:53 am
Location: mumbai,india
Contact:

Post by prakashadmane »

ya restart it but still face problem
flann
Forum Commoner
Posts: 38
Joined: Tue Aug 23, 2005 10:48 pm

Post by flann »

the reason you're getting the error is because DB isn't installed yet even though pear is. On a linux box it's easy to install DB, however by the looks of your code above you're on a windows machine.

look at this page, it explains how to install DB on a windows machine. http://www.design-ireland.net/index.php ... 0000000041
xnachocr
Forum Newbie
Posts: 1
Joined: Sat Nov 21, 2009 3:01 pm

Re: pear problem

Post by xnachocr »

try this code to test your connection

Code: Select all

 
<?php
require_once( "DB.php" );
$dsn = 'mysql://USER:PASSWORD@localhost/DBNAME;
$db =& DB::Connect( $dsn, array() );
if (PEAR::isError($db)) { die($db->getMessage()); }
?>
 
replace USER, PASSWORD, localhost, DBNAME with your own details.
if not error, everthing is ok with your DB.php and pear, so it must be your code
Post Reply