How to Fix the “PHP Version Mismatch” Error When Updating WordPress

Are you encountering the frustrating error message: “You cannot update because WordPress 6.7.2 requires PHP version 7.2.24 or higher. You are running version 5.6.40” when trying to update your WordPress website? This error usually occurs when your server is running an outdated PHP version, preventing you from using the latest features and updates in WordPress.

In this blog post, we’ll guide you through how to resolve this issue and make sure your website is running on the most up-to-date PHP version for maximum performance, security, and compatibility.

php-wordpress-update-error

What is PHP and Why is it Important for WordPress?

PHP (Hypertext Preprocessor) is the server-side scripting language that powers WordPress. It processes all the dynamic content on your website, handles databases, and allows WordPress to perform all its functions. WordPress requires a minimum PHP version of 7.2.24 for the latest updates and security patches.

Running an outdated version of PHP, like PHP 5.6, can lead to:

  • Compatibility issues with plugins and themes.
  • Slower website performance.
  • Security vulnerabilities.

That’s why it’s essential to ensure your PHP version is up-to-date. WordPress 6.7.2, for example, demands PHP 7.2.24 or higher to run smoothly.

Step-by-Step Guide to Fix the PHP Version Mismatch Error

If you’re seeing the PHP version error on your WordPress site, follow these steps to resolve it:

1.Check Your Current PHP Version

Before making any changes, you need to confirm which PHP version your server is running. Follow these steps to check your PHP version:

  1. Log into your cPanel account (or hosting control panel).
  2. Look for the “Select PHP Version” or “PHP Selector” option under the Software section.
  3. Check the version of PHP that is currently selected. If it’s PHP 5.6 or lower, you’ll need to update it.

If you are using the hosting service from Godaddy, you can manage the php version from the hosting management page as showing in the image below. Click on “Manage ” and a pop up opens for selection of php version.

2.Update PHP Version Using cPanel

If you’re using cPanel (or a similar control panel), it’s easy to update your PHP version:

  1. In cPanel, go to the Software section and click on Select PHP Version.
  2. From the dropdown menu, select PHP 7.2.24 or higher (we recommend PHP 8.1 or 8.0 for better performance and security).
  3. Save your changes.

If you’re not using cPanel, you can reach out to your hosting provider’s support team to update PHP for you.

3. Confirm PHP Version is Applied to Your Website

Sometimes, the PHP version you select in cPanel may not be applied to your actual website. Here’s how to verify:

  1. Create a new file named phpinfo.php in your public_html directory (where WordPress is installed).
  2. Add this simple line of code to the file:
<?php phpinfo(); ?>

3. Save the file and visit it in your browser by going to the http://yourdomain.com/phpinfo.php

5. This will show you detailed information about the PHP version your website is using. Ensure it shows PHP 8.1 (or whatever version you selected).

    Once you’ve confirmed the correct version, delete the phpinfo.php file for security reasons.

    4. Check .htaccess for PHP Version Overrides

    In some cases, the .htaccess file might override your PHP version settings. To fix this:

    1. In File Manager (cPanel), locate your .htaccess file in the public_html folder.
    2. Look for any lines that force a specific PHP version, such as:
    AddHandler application/x-httpd-php56 .php

    3. If you find such a line, update it to:

    AddHandler application/x-httpd-php81 .php

    4. Save the changes and check your site again.

    Why Should You Keep PHP Updated?

    Performance: Newer versions of PHP, like PHP 8.1, are optimized for better performance, which can lead to faster loading times for your website.

    Security: Older PHP versions, especially PHP 5.6, are no longer supported with security patches, leaving your site vulnerable to hacking attempts and malware.

    Compatibility: Many modern WordPress themes and plugins require at least PHP 7.2 to function correctly. Using the latest PHP version ensures compatibility with these tools.

    label, ,

    About the author