Mysqli extension for php 5

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

Could anyone please tell me how can I trouble shoot this problem?

What sub version of PHP 5 are you running?

The first couple of times I installed PHP on my CentOS 7, I don’t recall uncommenting anything. Though I was installing PHP 7. This was last year so I haven’t brushed up on it neither have I used my CentOS 7 for a while.

I believe all you have to do is just

yum -y install php-mysqli

As you would with any package. You generally do the same thing in Ubuntu as well. Say we want to install cURL since it hasn’t been installed on Ubuntu, we would install it depending on which version of PHP we are using.

For PHP 5, it’s

sudo apt-get -y install php5-curl

For PHP 7, it’s

sudo apt-get -y install php7.0-curl

Here is my CentOS 7 php.ini file. As you can see, the extensions aren’t managed in php.ini as if it would on Windows. They are maintained in a different way.

I am using PHP Version 5.4.16

@spaceshiptrooper Thanks for sharing your ini file. I tried running the following and got the following results. However, the following command started returning result which was returning nothing last time I checked:

]$ php -m | grep mysqli
 ]$ sudo yum -y install php-mysqli
Loaded plugins: langpacks, rhnplugin, ulninfo
This system is receiving updates from ULN.
ol7_x86_64_UEKR3                                                                                                                      | 1.2 kB  00:00:00
ol7_x86_64_latest                                                                                                                     | 1.4 kB  00:00:00
Package php-mysql-5.4.16-42.el7.x86_64 already installed and latest version
Nothing to do

It might be worth checking that the php.ini file that PHP is using is the one you think it’s using. Sometimes a server might have multiple php.ini files. Use phpinfo() to see which one PHP is actually using

Thanks everyone. The command php -m | grep mysqli seems to be returning the result for some reason and I believe the issue has been resolved.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.