In this article multiple actions you can take to secure your cPanel login and website are provided with explanations.
If you’re setting up WordPress on a new Linux VPS, you might see this error message: “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.”
It means your PHP installation appears to be missing the MySQL extension. It is required by WordPress” for it to function normally. If you don’t have it, this will stall your WordPress installation process. This is a common problem when you’re using a new Linux VPS because the MySQL extension doesn’t come by default with most operating systems.
You can’t complete the WordPress installation process unless you add the missing MySQL extension.
In this tutorial, we’ll be walking you through the steps to fix the “Your PHP installation error message on:
Let’s start with how to fix the error message on a new Linux VPS!
If the message “Your PHP installation appears to be missing the MySQL extension which is required by WordPress” on a new Linux VPS, here’s what you can do:
This is the first piece of information you’ll need. We’ll get to what you should do with the information later. To check MySQL version, enter the following command on any Linux distribution: MySQL–version
The error message is caused when the PHP code in your site isn’t compatible with the version of PHP your site is using. If your site is using the outdated MySQL extension which was removed as of PHP 7.0, you’ll see the message.
If you’re using a version of PHP above 7.0 and you’re still seeing this error, this means you have old code that needs to be upgraded. To fix this, you’ll need to upgrade the core WordPress files to the current version. (You’ll also need to upgrade any plugins your site is using.)
To check your PHP version, you’ll need to have SSH access to the server. Connect to your Linux VPS using SSH and type the following command:
Add the following content to your file:
<?php phpinfo(); ?>
If you’re running an Ubuntu VPS and PHP 7, run these commands:
apt-get install php7.0-mysql
Once you’re done with that, restart your Apache service so the changes can take effect.
If you’re running PHP 5, you’ll need to update PHP, for MySQL to be compatible with it. To do that, run these commands:
apt-get install php-mysql
If you’re not running a CentOS VPS, use the following command:
apt-cache search mySQL
If you are running a CentOS VPS and have already installed PHP 7, run the following commands instead:
yum install php70w-mysql
If you have PHP 5 installed on your CentOS server, run these commands:
yum install php-mysql
Restart Apache so the changes can take effect.
If you’ve carefully followed these steps, you shouldn’t see the error message anymore, and you can go on to install WordPress!
If you’re using a dedicated server, you may have the MySQL version 5.6. (Check MySQL version to make sure.)
If so, go to your site’s phprc file and add the following line:
extension = mysql.so
If you’re on a shared hosting plan, you’re probably seeing this error because the MySQL extension has been disabled on your hosting account. To enable the MySQL extension, follow these steps:
1: Log in to your cPanel account.
2: Click on Select PHP Version.
3: On the dropdown menu, select Current.
4: Click the checkboxes labelled mysqli and/or mysqlnd.
5: Click Save.
(If you’re using a hosting provider other than hosting.uk, cPanel might not have the Select PHP Version option. In that case, you’ll have to contact your hosting provider and ask them to enable this feature for you.)
If you’re on a cPanel server to which you have root access, you’ll need to use the EasyApache 4 interface in your WHM to enable and install the MySQL PHP extension.
Here’s how you do this:
1: Log in to your WHM as root.
2: Click EasyApache 4
3: In the highlighted box labelled Currently Installed Packages, click Customize.
4: Select PHP Extensions.
5: In the search box, type mysql. (This will give you the mysqlnd options.)
6: Select the mysqlnd extension you need. (You can even select all of them if you want.)
7: Click Review, then scroll down and click Provision.
8: Click Done.
That’s it! Now, you should be able to continue installing WordPress!
This tutorial should help you get rid of the missing MySQL extension error required for the PHP installation in WordPress. However, if fiddling with all these moving parts sounds like your idea of torture, you might want to try one of our managed WordPress hosting plans.
If you choose one of our Managed WordPress hosting plans, we handle the technical side of managing your WordPress website. So, you can focus on creating content for your website and on building your brand!
Like this post? Check out our previous post on website backup best practices for your WordPress website!