I want to use the pear package.Pear is already on my xampp package.On the file php.ini the pear is included(I didn't change the file php.ini..there is a line like include_path = ".;c\xampp\php\PEAR").I used the following code to retrieve the results from database..But it is not working ..

// Include the appropriate PEAR classes

$dsn = array(
 'phptype'  => 'mysql',
 'hostspec' => 'localhost',
 'database' => 'emp',
 'username' => 'root',
 'password' => 'mysql'
$dbh = DB::connect($dsn);

$stmt = "SELECT id, name FROM examples ORDER BY id";
$result = $dbh->simpleQuery($stmt, DB_FETCHMODE_ASSOC);
if ($dbh->numRows($result) > 0) {
 $data = (object) $dbh->fetchRow($result, DB_FETCHMODE_ASSOC);
 echo "id   => $data->id<br>\n";
 echo "name => $data->name<br>\n";


showing the errors like following ...

Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\divya\Pear-examples\dbconnect.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;c\xampp\php\PEAR') in C:\xampp\htdocs\divya\Pear-examples\dbconnect.php on line 3

include_path = ".;c\xampp\php\PEAR"

Anybody knows plz help me to solve this...


Member Avatar

Tried taking off the ';' before the statement?

;include_path = ".:/php/includes"


include_path = ".:/php/includes"

I removed the ; and tried..But again the same errors...What to do?Plz Plz help me....

Member Avatar

Well, you've probably got a few php.ini files in the installation - try doing the same to all of them. I always get confused as to why there are so many of them.

There is only one configuration file.Only php.ini...what to do?I am in trouble....

Member Avatar

Hmm. I'm lost. Anyone?

First, leave the php.ini files alone. The semicolon in the include path is correct for Windows (note the C:\ drive reference in the original post). The real problem is a missing pear/DB installation. The pear/DB is deprecated in favor of pear/MDB2, so you're experiencing a growth issue.

execute the following in the php installation directory:

pear install DB

...and viola - now you have an entirely new problem. Happy hunting...

Thank you very much Mr DC Buller................Now Its working..................You are kidduuuuuu....

i m facin the similar problem... and i am new to this stuff... can anyone let me knw how to install install db... thanks

I didn't understand ur problem?what u want to do?install pear on xampp?