Your PHP installation appears to be missing the MySQL extension which is required by WordPress Error and Solution

Posted on in Categories , , , last updated May 27, 2013

I‘m setting up WordPress based blog system under Debian or Ubuntu Linux. I am getting an error which read as follows:

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

How do I fix this problem under Debian or Ubuntu Linux?

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 as MySQL hostname while performing wordpress installation.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 38 comments/add one below):

38 comment

  1. I’m having the same problem trying to install on my localhost in Windows XP environment – any tips on how to fix that? I tried the above and that didn’t work. I’m running Apache 2 and PHP MyAdmin 5.2 (I believe). Everything else works fine and I can create and access MySQL databases in PHP MyAdmin without any issues.

  2. I am trying to install wordpress under debian.
    It is not my first installation, neither the second. It always gone ok.
    Not I got the same error pointed out here (you can go to the website). I do have php-server installed and running, I do have php5 installed. I do have the module php5-mysql.

    And it still gives me the same error.

    Who can help me?

    Thanks, Mariana

  3. Sorry I wrote “Not I got the same error ..”, I meant “Now I got the same error..”

    And also “I do have php-server installed and running”, I meant “I do have mysql-server installed and running”

  4. Morning….The blog has been working for YEARS, then all of a sudden this morning I am getting: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.. I’ve read the above but I don’t know what it means. I also can’t access my control panel inside of wordpress anymore. Can someone please give me step-by-step on how to fix this? I need this back up asap. Thank you!

    1. First, these commands need to be typed using a ssh session. Can you access your server using SSH? Are you a server admin? Is your server is managed by a hosting company? Is it on a shared hosting account? If so contact tech support. These commands will only work if you know how to use ssh and login as root user.

  5. Old post I know, but I’m trying to run MySQL 5.1.58 on Ubuntu 12.04, It’s a task I was assigned. I’m also trying to run Apache and PHP5. I compiled MySQL 5.1.58 and apt-get both Apache and PHP5. Everything works great, but when I try to connect PHP and MySQL with php5-mysql, it breaks MySQL.

    When I run ./bin/mysqld_safe –user=mysql &, I get an error about /var/lib/mysql for .err, not being there. I tried ln -s to the mysql install location, that fixes that error. When I check the .err file it says:

    [ERROR] Can’t find messagefile ‘usr/share/english/errmsg.sys’
    [Note] Plugin ‘FEDERATED’ is disabled.
    /usr/local/mysql/bin/mysqld: Uknown error 1146
    [ERROR] Can’t open the mysql.plugin table. Please run mysql_upgrade to create it.
    InnoDB: Initializing buffer pool, size = 8.0M
    InnoDB: Completed initialization of buffer pool
    InnoDB: Operating system error number 13 in file operation.
    InnoDB: The error means mysqld does not have the access rights to
    InnoDB: the directory.
    InnoDB: File name ./ibdata1
    InnoDB: File operation call: ‘create’.
    InnoDB: Cannot continue operation.
    mysqld_safe mysqld from pid fiel /var/run/mysqld/ ended

    I don’t understand what ‘access rights’ mysqld needs, when I check them, mysql user has ownership of data file in /usr/local/mysql/. Is there something I’m missing/doing wrong? Appreciate any help.

  6. As an alternative to the above solution, you can simply apply the following patch to your WordPress:

    The full instructions are at the link, but it simply involves extracting the compressed folder and copying the db.php file into your wp-content directory. It quickly fixed the problem for me (I am using Fedora Linux with PHP 5.5.7).

  7. After I upgraded from php 5.5.9 to 5.5.38 under Ubuntu 14.04.5, and disabled the old (a2dismod php5) and enabled the new (a2enmod php5.5), I get the error (thread title). My mysqld is still running though… So I recovered the site by reversing the a2dis/enmod calls.

    When I run the “dpkg –list | grep php5-mysql”, I get nothing, so for 5.5.38, I need to apt-get this package? I didn’t need this for 5.5.9 then? If I get it, can I revert back to 5.5.9 if I wanted to?


Leave a Comment