enabling mysqli extension on centos server

46,557

Solution 1

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.

Solution 2

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
extension=mysqli.so

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

[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
Share:
46,557

Related videos on Youtube

Tan
Author by

Tan

Updated on September 18, 2022

Comments

  • Tan
    Tan almost 2 years

    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?