Recently I discovered that mysqli extension is not installed in my server Centos version 2.6. I confirm it because I change the driver of db connection from mysqli to mysql and now works fine. So, is there another way/log to determinate this problem? because the apache error_log does not say anything about it.

This really is not a problem, but it could be more complex in future. Why? because using the mysqli driver, the website die with a blank page with no errors/warnings to help me to troubleshooting it. I don't like the idea of discover the problems with magics arts or testing line per line. Should be some log file that help me to debug it.

In order provide information to help on this issue, I did:

 cat /proc/version 
 Linux version 2.6.18-308.el5.028stab099.3 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46))
  • What is the problem then? You know mysqli isn't installed and setting it to mysql seemed to solve your problem. Also, are you sure you're using CentOS version 2.6? Nov 2, 2012 at 20:37
  • @AlexanderJanssen, I have updated the post :)
    – manix
    Nov 2, 2012 at 20:51
  • 1
    So you want to use the mysqli driver in you PHP application? Did you try to yum install php-mysqli? Or, if you wanna check if it's installed, do a simple rpm -q php-mysqli. Nov 2, 2012 at 20:54
  • @AlexanderJanssen, sorry for my poor explanation: it's not my native lang. I know how to install mysqli. Suppose that you don't know why your page is totally in white, exist any log file where I could see errors like [november 2, 2012] php doesn't know what mysqli is in index.php ??. With this error I can figure out that there is something wrong with mysqli and then I (or my partners) can fix it.
    – manix
    Nov 2, 2012 at 21:06
  • Sorry, I'm lost here. If your PHP application fails, the PHP code should include error messages. How to do this properly is explained in php.net/manual/en/book.errorfunc.php . Nov 2, 2012 at 21:12

3 Answers 3


You can confirm that mysqli is installed, or not, by listing the installed modules. SSH into your Cent OS box, and issue the following command.

php -m | grep mysqli

If nothing is returned, then you do not have mysqli.so loaded. Check if you have the shared object is installed on you system.

# Located extension dir
php -i | grep extension_dir
# List mysql.so in the path returned from the previous command
ls -la /usr/lib/php/extensions/no-debug-non-zts-20090626/mysqli.so

If the mysqli.so is present, and has the permissions -rwxr-x-rx, you'll need to load/enable the mysqli extension in the systems global php.ini file.

# Adjust path to correct php.ini file. 
# Run `php -i | grep "Configuration File"` to locate, if needed
# It might be easier to use vi, or nano, for this
sudo echo "extension=mysqli.so" >> /etc/php5/php.ini
# Restart apache
sudo service httpd restart

Else. If you do not have mysqli.so present in your system. You can install the rpm by following your systems package manager, and repeating the previous php.ini step.

sudo yum install php5-mysqli

Surprisingly sudo yum install php5-mysqli this did not install mysqli package for me. More surprisingly, I have PHP Version 5.5.31 and I assumed, it had installed mysqli by default. But I was wrong. I had to install and rebuild apache from WHM.

To install mysqli using EachApache:

  1. Login to WHM as 'root' user.
  2. Either search for "EasyApache" or go to

  3. Software > EasyApache Scroll down and select a build option (Previously Saved Config)

  4. Click Start "Start customizing based on profile"
  5. Select the version of Apache and click "Next Step".
  6. Select the version of PHP and click "Next Step".
  7. Chose additional options within the "Short Options List"
  8. Select "Exhaustive Options List" and look for "MySQL Improved extension"
  9. Click "Save and Build"



Just to answer this for all Windows users (like me) and to add up to emcconville's perfect accepted answer:

You can confirm that mysqli is installed, or not, by listing the installed modules. SSH into your Cent OS box, and issue the following command.

php -m | findstr /C:"mysqli"

You can use the following command to find, where PHP is installed on you system.

where php 
:: Returns C:\PHP\php.exe on my system
:: This yields to extensions being here: C:\PHP\ext
dir C:\PHP\ext | findstr /C:"mysqli"
:: shows weather "php_mysqli.dll" is installed

Loading and enabling the extension works just as in Linux - it also lies at the path found above with where php. Notepad does the trick too, but echo "extension=mysqli.so" >> /etc/php5/php.ini works too in a command line with sufficient permissions.

If it isn't present, refer to here for loading/installing, especially paragraph "Loading an extension"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .