Jump to content

configuring mysqli


cougar23

Recommended Posts

I'm trying to test the mysqli functionality so I can start developing.  I put in some basic code:

 

<?php

     //establish MySQL connection

     $db = new mysqli('localhost', 'admin', 'admin', 'mydatabase');

 

     //if connection failed, exit file

     if(mysqli_connect_errno()) exit;

     else echo 'connection established';

?>

 

And when the page loads I'm getting the error:

Fatal error: Class 'mysqli' not found in C:\Apache2.2\htdocs\sportsdata\index.php on line 22

 

I've set the extension_dir to "C:\PHP\ext" and uncommented the "extension=php_mysqli.dll" line in php.ini, restarted the server (I'm in Windows Vista environment), and still get the error.

 

Other info from phpinfo() that might help in your replies are:

Configuration File (php.ini) Path  --  C:\Windows 

Loaded Configuration File -- C:\PHP\php.ini 

extension_dir -- C:/PHP/ext

include_path -- .;C:\php5\pear

**no listed Additional Modules**

 

I'm sure i'm missing something basic, but I'm transitioning over to PHP from Java.  Thanks in advance for you time and help.

Link to comment
Share on other sites

From the mysqli installation section in the php manual -

 

Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH.

 

The best way to correct this is to add C:/PHP to the Windows PATH statement (reboot or log off/log on to your Windows user to get any changes made to your Windows PATH statement to take effect.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.