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
- Benefits of Keeping PHP Updated
- How to Check Your PHP Version
- How Your Website May Be Affected After the PHP Update
- Things to Do Before Updating PHP
- How to Update PHP in cPanel
- PHP Updated in cPanel Successfully!
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
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:
- Sign in to your cPanel account.
- Go to “Software.”
- If the “MultiPHP Manager” option is displayed on your cPanel, follow the steps for “How to Update PHP in cPanel: MultiPHP Manager.”
- 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:
With the handler file removed, follow these steps:
- In the “Software” category, click on the “MultiPHP Manager” option.
- Choose the website you wish to upgrade PHP by selecting the box.
- Select the latest PHP version from the drop-down, then click “Apply.”
- 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:
- Select the “PHP Selector” option under “Software.”
- 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.
- 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.