PHP is the underline server-side programming language used by WordPress. PHP powers ~78% of sites, and surprised to find out ~43% of them use PHP 5.
Keeping PHP up-to-date is crucial for two reasons.
Performance
The latest PHP 7.x is two times faster.
Security
Using a supported version means if there are any vulnerabilities, it would be fixed on priority. The new version often contains bug fixes. There is another factor – compatibility. If you are running on an older PHP version, then there is a chance that the new plugin may not support that. WordPress officially recommend to use PHP 7.4 or greater. What PHP version is your WordPress site on? There are multiple ways to find out. But one of the quickest ways is by going to:
WordPress Admin » Tools » Site Health Click on the Info tab. Expand the Server section, and you would see the PHP version.
Congratulations if your WordPress is running on the latest PHP version. If your WordPress is on the older PHP version, then here is how you can upgrade to the latest.
cPanel
Most of the shared hosting offers cPanel and if you are using too, then updating PHP is just a matter of a click.
Login to your hosting cPanel Search for PHP version on the top field Click on Select PHP version Click on the drop-down next to the current PHP version and select the latest one (at the time of writing, 7.4 is the latest one) Click set as current
That’s easy! If your cPanel doesn’t have the latest PHP version, then most likely, your hosting provider doesn’t offer that yet. You may speak to your hosting support and see if they can do it for you in the background. If not, you may want to move out to the platform that keeps their technology stack up-to-date, like A2 hosting.
EasyEngine
EasyEngine lets you set up and manage WordPress on cloud VM or VPS. It is based on Docker, and I’ve explained here how to use it. If you are using EasyEngine, then you are one command away to update your WP site. First, check out the supported PHP versions on their official site. Once you know which version you want to update to, you can execute the ee site update command as below.
Login to EasyEngine server Execute the following command
$YOURSITE – your actual site name. If you don’t know your site name then you can execute the ee site list –enabled to find out. $VERSION – the PHP version you want to update to Below example for updating geekflare.com to 7.4 version It will take a few seconds to upgrade.
SiteGround
SiteGround is one of the popular hosting platforms for WordPress, Joomla, and other CMS. Lately, they have moved their infrastructure to Google Cloud and got their own panel to manage the site. The excellent news is SiteGround automatically updates the PHP version to the most stable version; however, if you need to change that for whatever reason, it is possible.
Login to SiteGround Go to the Websites tab and click on Site Tools next to the site you want to change Go to DEVS at left navigation and PHP manager Click on the pen icon next to the current version
It’ll open a popup where you can select change PHP version manually
Select the version you need and click confirm
It will take a few seconds and update your WP site’s PHP version.
Kinsta
Kinsta offers a premium managed WordPress hosting. Their infrastructure leverage Google Cloud and you can change the PHP through MyKinsta.
To do so, login to MyKinsta Select the site and go to the Tools tab Modify under PHP engine
It will take up to 3 minutes, and you are all set!
CentOS 8.x
Are you managing WordPress yourself on DigitalOcean or other cloud VM? Sure! You can easily upgrade PHP on CentOS 8.x as the following. Default CentOS 8 will give you PHP 7.2. Let’s say you need to upgrade this to the latest one 7.4 First thing first, you’ll need to install the REMI repo with the DNF command. Ex: Let’s list the available PHP module with dnf module list php after we added the REMI repo. As you can see, 7.2 is the default and enabled but can activate another version, such as 7.3, 7.4, and 8.0. PHP 8.0 is still in beta, so it is not recommended for the live site. Let’s enable 7.4. Once enabled, you should run the module list command to verify. As you can see above, 7.4 is enabled now. And, finally, we can install PHP 7.4 with dnf install as below. Once done, check the version to verify. Great! Do you want to play around with PHP 8.0 beta version? If yes, then run the below. And then verify the installed PHP version.
Ubuntu 18.x
The default repository of Ubuntu 18.x installs PHP 7.2, and to install PHP 7.4; we need to add the below repository.. And, then install Let’s verify the installation.
Cloudways
Using Cloudways? Why not! They let you host your WordPress on DigitalOcean, Linode, Vultr, Google Cloud, AWS without going through the lengthy setup process. With one click, your WP is ready. Cloudways is a managed cloud hosting platform. It would be a perfect choice for anyone who wants to host a site on the cloud but doesn’t want to dirty the hands with the configuration, setup, and maintenance. To change the PHP version on a server managed by Cloudways:
Go to the server » Settings & packages. Edit PHP version to select the desired version and save
It will take a few minutes to update the package on the server in the background.
Conclusion
Keeping website technology stack up-to-date is essential for performance and security. If you are still using the old PHP version on your WordPress, then you should consider upgrading them, as explained above.