I tried to install wordpress but when I browse to the webpage I get:

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

I launched an Amazon EC2 instance with ubuntu 22.04. Then I installed apache2, php 8.1, MariaDB 10.6.11 and php8.1-mysql. I unzipped wordpress 6.1.1 into the root directory (/var/www/html).

I created config.php and edited it to contain the DB_NAME (wp), DB_USER (wpuser), DB_PASSWORD and DB_HOST (localhost). When I run SHOW GRANTS as wpuser one of the output lines is (bacticks converted to single quotes):

GRANT ALL PRIVILEGES ON 'wp'.* TO 'wpuser'@'localhost'

When I run phpinfo() from the site I can not see a section headed "MySQL" which seems wrong to me although I have seen some information suggesting the MySQL PHP extension is not required for modern versions of PHP and Wordpress.

I thought I might need a php-mysqli extension so I tried to install that but got the following output:

/var/www/html$ sudo apt-get install -y php-mysqli
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php8.1-mysql' instead of 'php-mysqli'
php8.1-mysql is already the newest version (8.1.2-1ubuntu2.9).
php8.1-mysql set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

I have run out of ideas for troubleshooting this issue and would be grateful for some help.

  • 1
    Is PHP running as a service (eg php8.1-fpm)? If it is, restart the service to reload the config. If not, restart Apache to reload the config.
    – Pat J
    Jan 6, 2023 at 3:32
  • 1
    Thanks! That was it. Jan 6, 2023 at 8:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.