Link to home
Start Free TrialLog in
Avatar of PhotoMan2000
PhotoMan2000

asked on

Unable to use the MySQLi database because the MySQLi extension for PHP is not installed.

I get this error when I switched my Drupal from IIS7 to Apache 2.2.15.
With IIS-7 - it runs fine,
When I switch to Apache I get the above error.

I didn't change the code in my php.ini - currently:

;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll

The file mysqli.dll does exists on the server.

And I've googled for a solution but get all the same responses, to check the php.ini or httpd.conf file - but it runs fine under IIS-7

Please advise a solution?

Avatar of junipllc
junipllc
Flag of United States of America image

The first thing I would do is to run a phpinfo -- create an HTML file and put the code below into it. Then load the page in your Web browser, using the Apache server. (forgive me if this is elementary for you, I don't know what your level of experience with PHP and/or Apache is)

If you look through the output from phpinfo you might be able to find out where it is failing, or if, indeed, the MySQL libraries are being loaded into the PHP/Apache stack. If they aren't, then this is usually  caused by some sort of library or extension missing in your installation, or possibly that Apache isn't loading the proper module -- which is why everybody is telling you to check httpd.conf and php.ini.

Keep in mind that on my systems (Linux, but similar since you're using an xAMP stack) the php.ini file for Apache and the php.ini file for command-line or other Web servers is actually a completely different, separate file, so be sure you're checking the proper php.ini for loaded extensions (the line that loads mysqli looks something like this on my system: extension=mysqli.so)

If you can't figure it out you can always post the phpinfo output here....but beware that it is a security risk to do so, as there is a lot of information in that output that can be used maliciously.

I hope this makes sense...I'd be happy to help further if you can't solve the problem.

<?php phpinfo(); ?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of junipllc
junipllc
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PhotoMan2000
PhotoMan2000

ASKER

Hi,
I've looked at both the PHP.ini and HTTP.CONF and all seems fine.
I posted the php.ini, before, here is the php section for the httpd.conf which appears at the very bottom of the file:

LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

The paths are accurate and the file is in it's proper place.

Here is the mysqli from the php info - it only runs on my local drive so I'm not worried about any external  security.

mysqli
MysqlI Support      enabled
Client API library version       5.0.51a
Client API header version       5.0.51a
MYSQLI_SOCKET       /tmp/mysql.sock

Directive      Local Value      Master Value
mysqli.default_host      no value      no value
mysqli.default_port      3306      3306
mysqli.default_pw      no value      no value
mysqli.default_socket      no value      no value
mysqli.default_user      no value      no value
mysqli.max_links      Unlimited      Unlimited
mysqli.reconnect      Off      Off


One thought.. does the sequence of installing PHP and Apache matter? I installed PHP first then Apache.

If I switch to the WAMP -- should I remove my previous Apachee and PHP installed before installing WAMP?

Thanks!
That certainly looks pretty good to me...especially since it's showing enabled. That makes me think there is a problem with Apache's config...but I can't be sure.

Usually when I install a stack I use a preconfigured one...but if not I install in this order: Apache, PHP, MySQL. If I need any extra libraries, I install them after that.

I think you will be better off with WAMP...it's all configured out-of-the-box for exactly what you're trying to do. It's less of a challenge ;) but it's also a heck of a lot easier. Most Drupalers (is that a correct term?) use a stack like LAMP on Linux, MAMP on the Mac or WAMP on Windows because it's tried and tested...and because it simply works. :) I think they even have T-shirts dedicated to the LAMP (WAMP/MAMP) stack:

http://www.tshirtbordello.com/Shirts/c1/p405/I-love-(heart)-LAMP-T-Shirt/product_info.html

If you do switch to WAMP I would probably remove Apache and PHP...but only if you don't have any crazy customization going on...or at the very least I'd back everything up if you have anything to lose in your configuration before you install WAMP.

Let me know how it works out (or doesn't) -- but I'm 95% certain this will solve your problem, and then some.

Mike
Thanks I'll give WAMP a try and uninstall the others.
I'll get back to you on this shortly..

Actually, WAMP is not the best choice at the moment. Try XAMP. It's much better than WAMP (for macs try MAMP).

XAMP is what I use but I used WAMP for years. I find XAMP a lot more stable and easier to use. I eventually switched from WAMP to XAMP because WAMPat the time refused to work on VISTA.

Things may have changed lately but XAMP remains a solid solution.
This is what eventually worked - but I had to uninstall both PHP and Apache - then WAMP.  I was never able to figure out why the other wasn't working.