Mysql – Confirm that thesqli extension is not installed

loggingMySQLPHPphp5

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))

Best 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 | 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