WordPress localhost installation error – Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Solution:1

Install your mysql library for php, run:

 sudo apt-get install php5-mysql

And restart apache:

 sudo service apache2 restart

Retry WordPress installation!

Solution:2

First, make sure MySQL server is running. Type the following command at a shell prompt:

/etc/init.d/mysql status

If MySQL is not running, enter:

/etc/init.d/mysql start

If MySQL is not installed, type the following command to install MySQL server:

apt-get install mysql-server

Make sure MySQL module for php5 is installed:

dpkg --list | grep php5-mysql

To install php5-mysql module enter:

apt-get install php5-mysql

Next, restart the Apache2 web server:

/etc/init.d/apache2 restart

Now PHP support for MySQL should work without a problem. Also make sure you set localhost or 127.0.0.1 (recommended) as MySQL hostname while performing wordpress installation.

Solution:3

This is because your apache did not load with mysql module. This will resolve the issue :

yum install php-mysql -y 

once the installation is complete. Do a service restart

service httpd restart

Solution:4

What helped me is running:

$ php -v

Which showed feedback like:

PHP Warning:  PHP Startup: Unable to load dynamic library './msql.so' - ./msql.so: cannot open shared object file: No such file or directory in Unknown on line 0

Indicating that the .so files either don’t exist or the specified containing directory is wrong (ie not ‘./’). After running:

$ find /usr/lib -name "*.so" | grep mysql

I was able to find the .so files in a php directory, /usr/lib/php5/20131226/ :

$ ls
gd.so  json.so  mysqli.so  mysql.so  opcache.so  pdo_mysql.so  pdo.so  readline.so  ssh2.so

My fix was to change my php.ini file (/etc/php5/apache2/php.ini) to:

extension=mysql.so
...
extension_dir = "/usr/lib/php5/20131226"