4

I'm trying to install a Wordpress blog on my Linux server (CentOS 7.2), using PHP 5.4 and MariaDB, but I keep running into this error:

Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Have been searching around for posts related to this:

However, I already have php-mysql installed:

enter image description here

And I have the MySQL extension configured for php.ini:

enter image description here

But for some reason, the MySQL extension still isn't loading in phpinfo():

enter image description here

That's probably causing this error from Wordpress, any idea what might be happening? Why isn't the MySQL extension getting loaded in PHP? Maybe because I'm using MariaDB?

And here's the output of:

ls -l /etc/php.d , rpm -ql php-mysql and ls -l /usr/lib64/php/modules/

enter image description here

enter image description here

enter image description here

And the mysqli extension is installed and enabled:

enter image description here

enter image description here

Sayem Khan
  • 239
  • 1
  • 3
  • 8
  • 1
    Please, can you provide the output of `ls -l /etc/php.d` , `rpm -ql php-mysql` and `ls -l /usr/lib64/php/modules/` ? As you're using CGI/FastCGI server-API, I want to be sure there are no file-permission problems. Also: are you running under SELINUX? – Damiano Verzulli Jan 03 '16 at 12:50
  • I'm not running SELINUX, it's disabled. Just updated the post with those outputs, I have mysql and mysqli in all of those directories. – Sayem Khan Jan 03 '16 at 19:05
  • 3
    Please don't post screenshots of a terminal. Instead copy the text from the terminal to your question and use the code formatting feature. – kasperd Jan 10 '16 at 12:49
  • ` yum install php71w-mysqlnd` – IndieTech Solutions Nov 17 '17 at 15:41

2 Answers2

3

Alright... finally, so it turns out all I needed to do was restart PHP-FastCGI. Yay.

systemctl restart php-fastcgi.service
Sayem Khan
  • 239
  • 1
  • 3
  • 8
  • 1
    Thanks ! Had the exact same problem worked for me. Tho I used `systemctl restart php-fpm`. I am on Fedora 25 – godidier Oct 06 '18 at 15:55
2

Modern PHP applications use the mysqli extension which supersedes the insecure (and now deprecated) mysql extension. This should be enabled by default when you install the php-mysql package but you can check it by running:

$ cat /etc/php.d/mysqli.ini

; Enable mysqli extension module
extension=mysqli.so

To be sure that this module is enabled, check that this module is listed in the PHP info page that you showed a sample of. Note that it’s listed further down the page in the modules section.

If you have the PHP command line interface installed (from the php-cli package) you can easily check by running php -i | grep -i mysqli. This should include the following line:

MysqlI Support => enabled
Anthony Geoghegan
  • 2,875
  • 1
  • 24
  • 34
  • Just updated the post with some more output, I do have the mysqli extension installed and enabled. However, I'm not seeing it show up in the PHP info page... any idea why it's not getting loaded? – Sayem Khan Jan 03 '16 at 19:05
  • @SayemKhan That info looks fine. However, I've never ran PHP in CGI/FastCGI mode so I'm out of ideas. If I have time tomorrow evening (when I have access to a CentOS7 box), I'll try to replicate your set-up. – Anthony Geoghegan Jan 03 '16 at 20:33
  • Yup it turns out I forgot to restart PHP-FastCGI. Thanks for mentioning it and for your help. – Sayem Khan Jan 04 '16 at 01:47