How to Update PHP in cPanel

This site contains affiliate links to products. We may receive a commission for purchases made through these links.

To keep your WordPress website secure and working optimally, it’s essential to have the latest version of PHP installed. You’ll know that it’s time to upgrade if you’re experiencing problems with how your server manages PHP packages or WordPress advises upgrading your PHP. Although cPanel updates your PHP packages to new builds, it will not automatically upgrade the PHP version to the latest release.

Depending on your cPanel version, you will need to use the MultiPHP Manager or PHP Selector to upgrade. Keep reading to learn how to update PHP in cPanel with the instructions for both options and some helpful information about the upgrade process.

Benefits of PHP

PHP (Hypertext Preprocessor, originating from Personal Home Page tools) is an established open-source coding language. It is mainly used for web development, in which it excels.

Developers use this scripting language to build the server side of web apps. It is also used for executing commands, accessing files, and opening network connections. Two of the most popular software written on PHP are Facebook and millions of WordPress websites.

This effective and powerful development tool is popular due to several advantages:

  • An abundance of documentation. There are endless manuals, tutorials, and various reference documentation, which is invaluable for novice users.
  • Enhance loading speed. PHP makes web pages load quicker compared to several other web development technologies. For example, PHP is approximately three times quicker in most use scenarios than Python. In the SEO world, faster page loading times are significant for ranking higher in searches.
  • Excellent HTML compatibility. PHP and HTML have incredible synergy between them. Typically, a PHP script does not affect the HTML code of a web page but completes it while remaining within the borders defined by PHP tags, and vice-versa.
  • It’s cost-efficient. PHP is free as it’s an open-source web language and doesn’t require expensive software or licenses. Therefore, the cost of using it for web development is minimal.
  • Compatible with cloud services. Several cloud services support apps written in PHP.

Benefits of Keeping PHP Updated

As you need to keep your WordPress plugins and themes up-to-date, your website’s PHP version must also be updated. PHP experts recommend updating regularly and staying informed of inclusions in the latest changes.

Having the latest PHP version is extremely useful for the following:

  • Better security: The latest PHP versions are regularly safeguarded against security weaknesses. For instance, they are better at countering hackers since outdated code is not supported.
  • Performance: Up-to-date PHP versions include defect and bug fixes, which helps to keep errors on your website low, and a better user experience.
  • Increased speed: Updating to the latest PHP version can increase speed up to four times. This also improves the experience for users and your search engine rankings.
  • New features: Updated PHP versions contain new features for more website functionality. These features make things less complicated for developers, saving you money and time whenever you need to update.

How to Check Your PHP Version

The web hosting provider sets the PHP version at the server level. Here are the ways you can check the PHP version that you’re currently running:

  • You can run the “php-v” command prompt via your server command line.
  • Upload this PHP file to your server: “<?php phpversion(); ?>”
  • Ask your WordPress agency or your hosting provider.

How Your Website May Be Affected After the PHP Update

Once you upgrade, how your site is affected depends on how you’ve developed it. If it is built using HTML, the update will not affect it.

If your site is developed with PHP and the code is compatible with the latest PHP version, it should function the same or even better.

If you use WordPress or another CMS, you may notice some performance improvements, given that you have installed the latest version of the CMS.

Your site may give errors or stop working if you use outdated and unsupported code. In most cases, this is due to your CMS not being updated to the newest version or your website using custom code that was deprecated in the update. In that scenario, you’ll need to update the code for compatibility.

Things to Do Before Updating PHP

Before updating your PHP version in cPanel, there are a few things you should do first:

  • Ensure your WordPress core software is up-to-date. Ensure your site’s core plugins and themes are updated to their latest versions. This maximizes the chance of a smooth PHP upgrade with no compatibility issues.
  • Perform a website backup. Just like any significant update, it’s vital to create a backup of your website beforehand. This allows you to roll back to the previous version should the update cause problems.
  • Confirm the PHP compatibility of your website. It would be best if you also consider reaching out to your WordPress design agency to ask them to verify the PHP compatibility of your website.
How to Update PHP in cPanel

How to Update PHP in cPanel

Depending on your cPanel version, you’ll use MultiPHP Manager or PHP Selector to upgrade PHP. The later version is ending, so you’ll likely be using MultiPHP Manager.

Follow these steps to confirm which feature you need to use:

  1. Sign in to your cPanel account.
  2. Go to “Software.”
  3. If the “MultiPHP Manager” option is displayed on your cPanel, follow the steps for “How to Update PHP in cPanel: MultiPHP Manager.”
  4. Otherwise, follow the “How to Update PHP in cPanel: PHP Selector” instructions further down.

How to Update PHP in cPanel: MultiPHP Manager

If you upgraded using the PHP Selector before, you’ll need to delete the handler in your .htaccess file to update. It would like similar to this:

AddHandler application/x-httpd-php-edge.php

<IfModule mod_suphp.c>

suPHP_ConfigPath/opt/phpedge/lib

</IfModule>

With the handler file removed, follow these steps:

  1. In the “Software” category, click on the “MultiPHP Manager” option.
  2. Choose the website you wish to upgrade PHP by selecting the box.
  3. Select the latest PHP version from the drop-down, then click “Apply.”
  4. A pop-up message should indicate that the newest PHP version has been applied to your domain.

How to Update PHP in cPanel: PHP Selector

Here’s how to update your PHP version withPHP Selector:

  1. Select the “PHP Selector” option under “Software.”
  2. Go to the directory of the site you need to update. The “public_html” folder is the document root for the main website on your account.
  3. Click on the latest PHP version from the drop-down menu, then click “Update.”

The PHP Selector applies upgrades recursively. If you apply an upgrade to the directory, it will likewise be applied to the subdirectories, except if you use a different command for one of the subdirectories.

So to use another PHP version for an addon domain, go through the document root for the addon domain, then choose the correct PHP version.

PHP Updated in cPanel Successfully!

Your PHP version should continually be updated for a more secure and well-run website. The update process is relatively straightforward as it will be available to select via the MultiPHP Manager or PHP Selector feature.

Ensure all your WordPress plugins and themes are updated before upgrading PHP to avoid compatibility issues and consider creating a backup of your site first.

Leave a Comment

Your email address will not be published.

Special offer for our visitors

Get your Free Coding Handbook

We will never send you spam. By signing up for this you agree with our privacy policy and to receive regular updates via email in regards to industry news and promotions