The Complete Guide on How to Update PHP in WordPress

WordPress runs on PHP, a programming language used to process the data needed to display your website to the world. Although PHP is rarely seen by the everyday user, it remains crucial to the life of your WordPress site. Keeping your PHP version updated ensures your site is running securely and performing optimally. In this post, we’ll explain why it’s important to update PHP in WordPress, and show you different ways to do it.

What is PHP in WordPress?

PHP is an open-source, server-side scripting and programming language that is the backbone of WordPress. Unlike static HTML sites, WordPress sites generate their pages dynamically by pulling data from the server using PHP. The PHP code is used by the server to process what is needed to deliver an HTML page to your website’s visitors. The majority of WordPress core, theme, and plugin files are created with PHP.

Why Should You Update WordPress PHP?

There are two primary reasons why you should always update PHP in WordPress – speed and security. That being said, there are some other benefits as well like compatibility and new features to enjoy. Here are some key reasons to update PHP in WordPress.

Performance and Speed

Each time a web page is loaded in your browser, PHP has to process what the server needs, locate it in the database, and then send it back in HTML format so your browser can display it. Loading just one page can require a lot of PHP requests that slow down your page load speed. Since PHP continues to improve with each update, you will also see faster processing speeds and more efficient memory usage. That’s why running your site on newer versions will give you more speed and better performance.

Failure to update PHP in WordPress is a serious security risk. Older versions are no longer supported and have reached End of Life (EOL), which means that the PHP version will never be updated or checked for vulnerabilities. Running your site on these unsupported versions leaves you at risk of potential security breaches. To keep your site safe and secure, you should use a PHP version that is actively supported. At the time of this post, here is where things stand:

In short, update to the latest version of PHP as soon as possible. To see the current PHP versions available, check out the PHP supported versions page.

New Features

Every new version of PHP brings new features that allow you to make more powerful and dynamic websites.

Compatibility and Support

Making sure your PHP is updated will also ensure that your site is compatible with the latest version of PHP. This also keeps your site compatible with all themes or plugins that are optimized for the latest version.

It is also important to note that your site may not be compatible with the latest version of PHP. You could be running an older version of WordPress or have a theme or plugin running on older PHP versions. So you will want to make sure and test your website after updating it to make sure everything is still working properly. If not, you may have some dated plugins or other issues to address.

How to Check Your PHP Version

Before we check the PHP version (and update it), it is important to know which PHP version you should be using. Ideally, you will always want to use the latest version of PHP available. However, you must also make sure that your WordPress version is up-to-date and compatible with the latest version of PHP. WordPress has a PHP compatibility chart you can use.

Now that you know which PHP version you should be using, we can check which PHP version you are currently running on your site. Here are two simple ways to do that.

Check PHP Version Using WordPress’ Site Health Tool

One way to determine which version of PHP you are running is to take a look at Site Health in the WordPress dashboard. There are two sections for your site – status and info. On the status page, WordPress runs a series of tests to determine if your site needs updates to its core files, and plugins, and recommends improvements. During those tests, if you need to update PHP in WordPress, it will be displayed there.

Check PHP Version Using the Command Line

The last way to check which version of PHP is installed is to run a query in the command line. This can be done on Mac, Windows, and Linux. For this example, we’ll use the Terminal application on Max OSX. Before getting started with this method, you’ll need to have SSH access. If you need help on this, read our post explaining How to Connect Your Website Via SSH.

Once you have successfully established an SSH connection, open your console program and type in the following command:

The output will reveal the PHP version number, build date, and copyright information that looks something like this:

Steps to Take Before You Update Your Website’s PHP

Before updating PHP, there are steps you should take to ensure that the process is completed successfully. Let’s walk through the steps so you’ll know the best process to follow.

Step 1: Backup Your Site

This is probably the most crucial step to take before updating PHP in WordPress. You see, when you update any type of software, there’s always a chance an error can occur. If you don’t have a recent backup, you stand to lose any content you’ve recently added. Take a look at our post on the best WordPress backup plugins if you need a good backup solution.

Step 2: Check Your Server

The second step is to make sure your server supports the latest version of PHP. You can usually find this information in your hosting provider’s documentation. If not, speak with a customer service representative at your host. If your host doesn’t offer support for the latest version, you can formally request that they take steps to support it. At the time of this writing, most web hosts support version 8.0, with a growing number of hosts supporting 8.1. It’s worth noting that all of Divi’s hosting partners currently support the latest version.

Step 3: Update WordPress, Plugins, and Themes

The third step is to update all of your third-party plugins, themes, and WordPress core files before proceeding with a PHP update. If you don’t, you could cause conflicts between the latest version of PHP and any outdated software. Most developers release regular updates to their software to include compatibility with major releases of both WordPress and PHP.

Step 4: Test Thoroughly Before Upgrading PHP in WordPress

Lastly, use local development software such as MAMP to test your site with newer versions of PHP. This will help identify any plugins that don’t support that version, and any bugs you may run into before updating your live site. For information on how to use Mamp, check out our ultimate guide.

How to Update PHP in WordPress

There are several ways to update PHP in WordPress. It can be done through your hosting provider, using cPanel, SSH with terminal commands, or simply by requesting it through your web host. Let’s explore the different ways to update PHP in WordPress individually.

Hosting Site Tools

Updating PHP in WordPress is a fairly easy step within most hosting providers. While all hosting providers are different, most of them offer a way for the customer to update the PHP version. For all other providers not listed in our post, you can visit these tutorials to view your specific hosting provider’s process to update PHP in WordPress. For this post, we’ll concentrate on updating PHP in WordPress with our hosting partners – SiteGround, Flywheel, Pressable, and Cloudways.

Updating PHP in SiteGround

SiteGround offers an easy way to update PHP in WordPress. First, log in to your SiteGround dashboard. Next, navigate to Devs > PHP Manager. Click the pencil icon to edit the assigned version of PHP.

When the modal appears, choose Change PHP version manually. Under the dropdown menu, select the version of PHP you wish to update to.

Updating PHP in Flywheel

For Flywheel, the process is a bit different. To update PHP in WordPress, you’ll need to connect with a customer service representative. This may sound like a daunting process, but rest assured that it’s fast and easy. You can request a PHP upgrade in a few simple steps. First, log in to your Flywheel account. Next, click the Get Help button in the lower right corner of your screen.

The final step is to click the Chat Now button. From there, all you have to do is ask for Flywheel to perform the update.

As a bonus, they’ll ensure that there aren’t any conflicts after the update. If any issues are found, they’ll troubleshoot them and fix any issues that arise.

Updating PHP in Pressable

To update PHP in Pressable, start by logging in to your account at Click on the site you wish to update PHP on.

Next, under overview, select your desired PHP version from the dropdown menu. Pressable will automatically save your changes once you make a selection from the menu.

Updating PHP in Cloudways

To update PHP in Cloudways, start by logging into your account. Next, select servers in the navigation menu. Next, click on the server you wish to update.

Click on settings & packages on the menu on the left side of the page. Next, click on the packages tab. Finally, click on the pencil icon next to the current PHP version.

Choose your desired version of PHP from the dropdown menu, then click the save button.

A warning box will appear asking you to confirm that all installed software is compatible with your selected PHP version. Click ok.

Updating PHP Using cPanel

Another way to update your WordPress site’s PHP is to use cPanel. While every hosting provider is different, the steps are generally the same. First, log into your hosting provider’s website. Next, navigate to cPanel. Scroll down until you see the Software section. Next, click on Select PHP Version. From the dropdown menu, select your desired version of PHP. Click on it to set it as current.

Contacting Your Hosting Provider

If none of the other ways are accessible to you, there is still one more way to update PHP in WordPress. You can reach out to your hosting provider to ask that they update PHP for you. Most hosts can handle this request and can take care of it for you. As previously mentioned, hosts such as Flywheel offer access to chat with a representative who can take care of the update in a matter of minutes.

What to Do If Something Breaks

On the off chance that you encounter a problem, there are fixes if your site goes down or breaks during a PHP update. The most important thing you should do before updating is to ensure you are using a staging site, and create a backup right before beginning the process. This ensures that if you do have issues, you can safely roll back to your backup without skipping a beat.

Steps To Take to Fix Your Website

When your WordPress site isn’t functioning properly, it can be very frustrating. Thankfully, there are a few steps you can take to correct the issue you’re facing since the update. If you have access to the back end of your site, follow this quick guide to get your site back up and running.

Step 1: Disable All Plugins

If your problem stems from a plugin going rogue on you, disabling them can fix it. Start by disabling all of your plugins, then reactivate them one by one. If a plugin is a problem, the perpetrator will identify itself during this process. However, if this step doesn’t fix the problem, move along to step 2.

Step 2: Change Your Theme

Activate a WordPress default theme. A lot of times when your site is having issues, your theme can be the culprit. Third-party themes have a lot of extra functionalities in them that default themes don’t have. It’s best to temporarily swap to a more bare-bones theme to see if your site comes back up. If it does, you know the problem lies in the theme.

Step 3: View Error Logs

If you are still having trouble with your site, take a look at your site’s error logs to view any potential problems. Using the WordPress default Site Health tool is a great place to start. Navigate to Tools > Site Health. Here you’ll find two tabs – status and info. You can scroll through both tabs to get a better understanding of what’s going on with your website. Critical issues will be listed on the status page, along with suggestions on how to correct the problem.

Talk To Your Hosting Provider

If those steps haven’t solved the issue, reach out to your host. Most reputable hosting providers offer support for their customers. They will likely get to work by troubleshooting your site and helping you solve the problem.

If none of these steps work for you, you should take steps to downgrade your PHP version. You can reverse the update process listed above to safely revert to the PHP version you were using previously. If your hosting provider doesn’t support the latest version, you should seriously consider switching hosting providers. Divi partners with several highly recommended hosting providers that all support the latest version of PHP. We vet each hosting partner thoroughly before considering them, so rest assured that you’re making a wise choice if you choose to use them.

Updating PHP in WordPress FAQ

If you still have questions regarding updating PHP in WordPress, these should help.

What Happens If My Site Disappears or Breaks?

Although unlikely, it is possible your site can break during a PHP update in WordPress. When this happens, there are steps you can take to fix it. Using Recovery Mode through WordPress is an excellent way to bring your site back after an error.

What If I Don’t Have the Permission to Update PHP in WordPress?

If you find yourself in a situation where you are unable to update PHP on your own, your only recourse is to reach out to your hosting provider. You can request that they update PHP to the latest version. If they can’t support the latest version, or deny your request, it’s time to start shopping for a new hosting provider. As previously mentioned, running an outdated version of PHP leaves your site vulnerable to malware and other types of cybercriminal activity.

Can I Update PHP in WordPress If I Have an Apache/Nginx/Other Kind of Server?

Absolutely. Almost all servers are compatible with PHP. This includes Apache, Nginx, IIS, and Google Web Server (GWS).

Can I Use the Command Line to Update PHP in WordPress?

Yes. But this is definitely not recommended unless you are positive that you know what you are doing. The Command Line is a powerful tool that has the potential to seriously mess things up if you are inexperienced. It would be better to contact your hosting provider to make changes for you.

Updating PHP is Crucial to WordPress Websites

When using WordPress to build your website, it’s imperative that you keep all software up to date. This is especially true for PHP since it is the backbone of WordPress. By following the steps outlined in this post, you’ll keep your site safe, secure, and running optimally.

What method do you use to update PHP on your website? Let us know by sounding off in the comment section below.

This content was originally published here.

Sign Up for Updates and Special Offers

Jeff Kerby

CEO | KERBCO Web Services