1. Home
  2. Troubleshooting
  3. WordPress
  4. Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

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

When upgrading PHP you might run into this error on your WordPress installation:

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

A common mistake is to forget to update the PHP handler. A PHP handler is an Apache module that interprets and runs PHP code (could also be FPM (FastCGI Process Manager)).

To solve this, you have t update the handler to make sure you’re running all the appropriate extension. Update your respositories

sudo add-apt-repository ppa:ondrej/php
sudo apt update

Then make sure you install all the appropriate extensions:

sudo apt install php8.2 libapache2-mod-php8.2 php-common php8.2-apcu php8.2-cli php8.2-common php8.2-gd php8.2-mysql php8.2-opcache php8.2-readline

Now you can proceed with updating the handler to make sure it’s using the PHP version you just installed.

Confirm PHP Handler

Easiest way to confirm the handler is the add a phpinfo.php file to the root of your site and add this to it:

<?php

phpinfo();

Open the file in your browser and you should see this:

Setup A. Apache with PHP as an Apache module

Enable the new Apache PHP module:

sudo a2enmod php8.2

Disable the previous Apache PHP module (swap x with whatever previous version you were using – 7.2, 7.4, 8.1):

sudo a2dismod php7.4
sudo a2dismod php8.1

Restart Apache to make the changes take effect:

> sudo systemctl restart apache2

Setup B. Apache with PHP-FPM

Enable the new FPM:

sudo a2enconf php8.2-fpm

Disable the previous version of FPM (swap x with whatever previous version you were using):

sudo a2disconf php8.2-fpm 

Restart Apache to make the changes take effect:

sudo service apache2 restart
Updated on June 19, 2024
Was this article helpful?
Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Email: support@noc.org