How to Fix PHP Installation Error Instantly?

Home >> Blog >> How to Fix PHP Installation Error Instantly?
PHP Installation Error

How to Fix PHP Installation Error Instantly?

 Aug 26, 2022

PHP, the server-side scripting language used by WordPress to run themes and plugins, can be installed manually through various methods or through web hosting providers. If you’re trying to install WordPress, Magento, or other similar PHP platforms on your website, you may come across this dreaded error message: Your PHP installation appears to be missing the MySQL extension required to run this program. Please contact your host and ask them to enable the MySQL extension or if you are in control of the server, please put an extension in /etc/php5/cli/php.ini. More often than not, it is due to incompatible PHP versions on the host server. In this blog, we’ll share with you the 6 ways to fix this error in no time at all, let’s get started!

Recommended: Hire PhP Developers

What is the MySQL extension error while PhP Installation?

This error message appears when you try to connect to a MySQL database from your PHP script. This specific error is usually caused by a misconfiguration of your server or by a corrupt file. 

The easiest way to fix this is by installing the missing extension. However, if you don’t have access to your server’s php.ini file, there are a few other ways you can try. There are several possible reasons for this particular error. Here are these:

  1. You’re using an older version of WordPress.

This error appears when You’re using an outdated version of WordPress. You can fix it by updating WordPress to the latest version. Here’s how: 

1. Log into your WordPress site. 

2. Click on the Updates tab in the left-hand menu. 

3. If there is an update available, you will see a message that says An updated version of WordPress is available. Click the Update Now button. 

4. WordPress will now download and install the latest version. Once it’s finished, you will see a message that says WordPress updated successfully. 

5. You’re now running the latest version of WordPress!

  1. Your plugins need to be updated.

When you see the error message Your PHP installation appears to be missing the MySQL extension which is required by WordPress., it means that your server doesn’t have the MySQL extension installed or enabled. To fix this, you need to update your plugins. Here are six ways to do so 

1) Install a different plugin

2) Update your plugins manually

3) Reset all of your permalinks

4) Perform a full WordPress install

5) Install a new version of PHP on your server

6) Download and install phpMyAdmin

  1. The MySQL extension isn’t installed.

If you see the error, it means that the MySQL extension isn’t installed. This can happen for a few reasons: 

1. The server is using an outdated version of PHP. 

2. The server doesn’t have the MySQL extension installed. 

3. The WordPress files are corrupt. 

4. There’s a problem with the WordPress database.

  1. The PHP extension is not configured properly.

You can Check your php.ini file and make sure that the extension is uncommented. If you’re using a web server, make sure that the extension is enabled in your web server’s configuration. Try re-installing the extension.  PHP 7+ users: check that you have the correct version of the extension installed for your version of PHP.

Also See: The leading reasons to choose PHP for Web Development

Elaborative Step by Step Guide to Fix Wordpress MySQL Extension Error

  1. Check the version of your PHP

It’s important to know which PHP version you’re using when diagnosing an issue with MySQL. Luckily, there are two ways to find out! 

  1. If you’re logging in from your WordPress dashboard, select Tools > Site Health. 
  2. Under Site Health Status, WordPress will tell you which version of PHP your site is running – and if it needs updating.

If you are unable to login to your WordPress dashboard, then you’ll need to use an FTP client (FileZilla or other) to access your website. This method is more complicated than logging in through the Dashboard itself but still relatively quick and easy. 

  • Log into your hosting account using FileZilla or another FTP client (any will do). 
  • Navigate over to your public_html folder— this is where all of the files for your WordPress site are stored. 
  • Create a new blank text document (can also be created through WordPad/Notepad) and name it phpinfo.php . 
  • Once inside this file add the following line:

<?php phpinfo(); ?>

  • The html file can be tested by adding /htmlcid.html to your website’s URL.
  • Once loaded, the webpage will list all settings that are currently used on your art-related websight including version.
  • This test works for images too which saves time figuring out what needs editing first!

If your PHP starts with a 7, it means you may need to update your WordPress software. You can skip to Step 2. On the other hand, if you are still using PHP 5.X, it could mean that MySQL is not installed – so please follow Step 4 below!

2. Update Your WordPress Website

If you’re running PHP 7+ with an outdated version of WordPress, you might see the MySQL extension error. This is because PHP 7 has deprecated the old MySQL extension that this newer version of WordPress is looking for. 

Newer WordPress versions will use different extensions, like PDO_MySQL or MySQLi extensions; so you won’t see an error message anymore. That’s why you need to check whether there’s a new updated version of WordPress available right now! 

If you can still log in to your WordPress dashboard at all, then go ahead and make sure there’s no updates via [insert link]. Select Dashboard > Updates from the top menu bar.

If you see the message An updated version of WordPress is available, click Update Now . Choose either Update All , just themes , just plugins , etc., depending on what needs updating ASAP!

If you are having trouble logging into WordPress dashboard, just follow these steps:

  • Download the latest version of WordPress from their website. 
  • Extract the zip file. 
  • Log in to your site’s server via FTP and navigate to your wp-content folder. 
  • Rename the plugins folder plugins.hold. Delete both wp-includes and wp-admin folders. 
  • Upload the newly downloaded copies of those two folders – overwriting anything already there with identical names. 
  • Right click anywhere within the newly uploaded wp-includes or wp-admin folder, select New->File or Project->Folder. 
  • Select that newly created subfolder and upload all files – overwriting anything already there with identical names (if any). 
  • Upload everything else – loose files included – to your public_html root directory (aka what would be your website address bar)

Hot Topic: Python Vs PHP: Choose the right language for your web development needs

3. Update your plugins.

Outdated code for your plugins can cause compatibility issues with PHP; this often prompts an error from the MySQL extension. If you can log in to the WordPress dashboard, then look for out-of-date plugins that need updates there first before trying them through an FTP program.

If there is any trouble while logging into your WordPress dashboard, then you’ll need to find out which out-of-date plugins will need updating manually through an FTP connection on your end – either by downloading the plugin’s .zip file or uploading it manually (depending on what type of server/uploading app they use). You’ll also want to delete the old folder containing the outdated plugin so that you’re left with just a single (albeit updated) one.

4. You need to verify that the MySQL extension is properly installed.

Check that there is no problem with the extension you are using as described in The Setup. 

1. If you’re running a lower PHP Version than 5.6 (e.g. 5.3) and had seen mysql_connect errors when downloading wp-login using WPAD, it may indicate an issue with your database plugin or configuration file so please double-check your database settings again and make sure they work without any issues before continuing troubleshooting below.

2. Assuming everything has checked out up until now, go back to phpinfo();

3. Scan for Client API library version;

If there is no row where ‘client api’ appears either due to outdated Android phone device firmware/programming being too old OR because SQL Server driver mode wasn’t selected when installing MariaDB – confirm MySQL installation here before taking further steps.

5. Ensure that the PHP extension is properly configured. 

If you are running the latest versions of PHP and WordPress, it’s possible that your PHP extension is improperly installed, which causes Your PHP installation appears to be missing the MySQL extension which is required by WordPress errors.

To determine this, open up phpinfo.php again (or download another copy if you closed it) and find the row labeled Loaded Configuration File.

Compare its value to what is written in the row labeled extension_dir. If they don’t match up, edit php.ini and replace Loaded Configuration File with what’s written in extenion_dir.

Conclusion

Like any mistake made in WordPress, the SQL database error can be frustrating – and threaten to affect the user experience on your site. Following above mentioned steps will fix the problem so you can get back up and running as soon as possible, with minimal damage done to your website’s UX. You can also hire a reputed WordPress development company in India to ensure all the errors are fixed properly.