Page 1 of 1
pear problem
Posted: Tue Mar 13, 2007 1:59 pm
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
Posted: Tue Mar 13, 2007 2:06 pm
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
Posted: Tue Mar 13, 2007 2:15 pm
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
Posted: Tue Mar 13, 2007 2:18 pm
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
Posted: Tue Mar 13, 2007 2:18 pm
by RobertGonzalez
Did you restart the server?
Posted: Tue Mar 13, 2007 2:43 pm
by prakashadmane
ya restart it but still face problem
Posted: Tue Mar 13, 2007 2:49 pm
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
Re: pear problem
Posted: Sat Nov 21, 2009 3:13 pm
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