Frustrating error: extension not found

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aj574
Forum Newbie
Posts: 3
Joined: Mon Aug 15, 2005 3:26 pm

Frustrating error: extension not found

Post by aj574 »

I have a script that connects to a database using PEAR::DB for database abstraction. Here is the relevent part of the script:

Code: Select all

require_once('DB.php');

$db_engine = 'mysqli';
$db_user = '****';
$db_pass = '****';
$db_host = 'localhost';
$db_name = '****';

$datasource = $db_engine.'://'.
			  $db_user.':'.
			  $db_pass.'@'.
		 	  $db_host.'/'.
	  		  $db_name;

$db = DB::connect($datasource);
if (PEAR::isError($db)) {
    die($db->getMessage());
}
When I run this, I get the following error message:

DB Error: extension not found

I'm not quite sure which extension isn't being found correctly. I have the mysql extension enabled (and the dll is in the proper directory) in php.ini, and there are no errors about DB.php not being found. I'm stumped, can anyone help?

EDIT: I forgot to say, the ****'s all hold the proper values, and the database is indeed on the localhost. I'm using MySQL 4.1 and PHP 5 on Windows 2000 Professional with Apache 2.0.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you try setting the debug option? Maybe your version doesn't support mysqli, or doesn't have the mysqli class installed?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

my guess is that the op has (only) loaded the mysql extension. And he's asking pear::db to use the mysqli functions..

So, either load mysqli extension or change db_engine to mysql
aj574
Forum Newbie
Posts: 3
Joined: Mon Aug 15, 2005 3:26 pm

Post by aj574 »

When $db_engine is changed to mysql, I get the same error. I'll try setting the debug option and see what I get. Thank you for your help so far.
aj574
Forum Newbie
Posts: 3
Joined: Mon Aug 15, 2005 3:26 pm

Post by aj574 »

Do you mean setting the debug option DB::Connect, like so?

Code: Select all

$options = array(
    'debug'       => 2,
);

$db = DB::connect($datasource, $options);
if (PEAR::isError($db)) {
    die($db->getMessage());
}
I get the same error message no matter what value I set.
Post Reply