The error "PHP installation appears to be missing the MySQL extension" commonly occurs when setting up WordPress on a new Linux VPS. This happens because the MySQL extension for PHP is not installed by default on many operating systems. This guide shows you how to install the required extension and complete your WordPress installation successfully.

How to Fix the Missing MySQL Extension

  1. Step 1: Connect via SSH and check PHP version

    Connect to your Linux VPS using SSH and verify which PHP version you are running:

    php -v

    Alternatively, create a file named info.php in your public_html directory with this content:

    <?php phpinfo(); ?>

    Then access the file through your web browser to see detailed PHP information.

  2. Step 2: Install MySQL extension for Ubuntu/Debian

    If you are running Ubuntu or Debian with PHP 7.x, execute these commands:

    apt-get update
    apt-get install php7.0-mysql

    For PHP 5.x, use:

    apt-get update
    apt-get install php-mysql

    To search for all available MySQL-related packages:

    apt-cache search mysql
  3. Step 3: Install MySQL extension for CentOS/RHEL

    If you are running CentOS or RHEL with PHP 7.x, execute these commands:

    yum update
    yum install php70w-mysql

    For PHP 5.x, use:

    yum update
    yum install php-mysql

    To search for all available MySQL-related packages:

    yum search mysql
  4. Step 4: Restart your web server

    For the changes to take effect, restart the appropriate service:

    If using Apache:

    systemctl restart apache2

    If using Nginx with PHP-FPM:

    systemctl restart php-fpm
  5. Step 5: Continue WordPress installation

    Return to your WordPress setup in the web browser. If the MySQL extension was installed correctly, the error message will no longer appear and you can proceed with the WordPress installation.