I want to enable mysqli extension on Centos server where PHP 5 is installed. After searching online, I saw many people talking about uncommenting mysqli related line in the php.ini and I couldn't find anything related to mysqli in my php.ini file.

The following returns nothing : php -m | grep mysqli

How can I trouble shoot this problem?


Have you installed mysqli? If not, you'll need to run:

yum install php-mysqli

If that doesn't work anymore, you could try easyapache and select mysqli.


PHP installation does not include the support for MySQL database by default, so you need to install php-mysql package.

The php-mysql package contains a dynamic shared object that will add
MySQL database support to PHP.

Do it either from root account

$ su
# yum install php-mysql

or using sudo

 $ sudo yum install php-mysql

Then run again

php -m | grep mysqli

Everything should be fine. If the problem persists, make sure that file /etc/php.d/mysqli.ini has the following lines

# cat /etc/php.d/mysqli.ini 
; Enable mysqli extension module

p.s. Just for reference, my /etc/php.ini (i am using CentOS 6.9) has the following settings for MySQLi

; Maximum number of links.  -1 means no limit.
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.