Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install the MySQL extension for PHP 7 on CentOS 8?

I was trying to install WordPress on my CentOS 8 server today when I received this error:

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

I understand that this extension has been removed in PHP 7 and above.

I've tried both of the following:

  sudo yum update
  sudo yum install php70w-mysql
  sudo yum install php-mysql

However, I receive the following message:

 No match for argument: php70w-mysql
 Error: Unable to find a match: php70w-mysql

or

   No match for argument: php-mysql
   Error: Unable to find a match: php-mysql

Please let me know how I can get this MySQL extension installed.

Thanks for your help!

like image 380
arkitektron Avatar asked Mar 03 '23 04:03

arkitektron


1 Answers

as far as i know, php-mysql does not longer apply for centos8-PHP 7 and more, try this, it should update your PHP installation and enable you to use mysql commands>

yum install php-mysqlnd

do the normal installation process (y) and then, you can test with:

php -m

and check among the enabled modules/extensions, for the ones that start with mysql, you should have at least these two>

enter image description here

restart your apache service, and you should be OK.

like image 97
Pablo Contreras Avatar answered Mar 04 '23 18:03

Pablo Contreras