I'm using 32-bit Ubuntu 14.04 LTS. I've set my LAMP stack many days ago. Today I upgraded my PHP version to 5.6. Trying to Debug my WordPress plugin using php-cli and my console prompted me the strange message:

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

I tried all the possible solutions, like:

dpkg --list | grep php5-mysql
sudo apt-get install php5-mysql
sudo service apache2 restart


mysqldump --lock-all-tables -u root -p --all-databases > dump.sql
sudo apt-get remove mysql-server
sudo apt-get autoremove
sudo apt-get install mysql-client-5.6 mysql-client-core-5.6
sudo apt-get install mysql-server-5.6
mysql -u root -p < dump.sql

but nothing happened.

Sources: 1, 2, and 3

I tried <?php phpinfo();, it's displaying:

Client API version 5.5.50

But command like:

sudo apt-get install mysql-client-5.6 mysql-client-core-5.6

is displaying:

Reading package lists... Done
Building dependency tree
Reading state information... Done
mysql-client-5.6 is already the newest version.
mysql-client-core-5.6 is already the newest version.
mysql-client-core-5.6 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.

How can I solve the warning and make my PHP do my desired job?

  • What do you get when you run: php -r 'print_r(get_loaded_extensions());' | grep mysql ? – Scott Deagan Sep 3 '16 at 0:40
  • @ScottDeagan I'm afraid, nothing. Is that mean the MySQL extension is not installed. How come that is possible? And what are those messages, saying: mysql-client-5.6 is already the newest version, bla bla! :o – Mayeenul Islam Sep 3 '16 at 0:57
  • If you installed PHP from the repos, then sudo apt install php5-mysql should work. Because the above isn't returning anything, it means your MySQL extensions are not being loaded. If you've built PHP from source, you'll have to build with ./configure --with-mysql option. The only other thing I can think of is adding the following to your php.ini: extension=pdo_mysql.so, restarting apache, then viewing the output of php -m | grep -i mysql (to see if any MySQL modules are loaded). – Scott Deagan Sep 3 '16 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.