If you have a WordPress website, you must know that your website is being run by PHP. Your website, themes, and plugins are based upon PHP and with the help of scripts, PHP runs your website.
PHP allows you to have a website exactly the way you want. However, you don’t need to have any PHP knowledge, unless of course, you are interested in developing or curious to know about your website’s security and functionality.
In this article, we discuss how you can review and update the PHP version of your WordPress website.
How to update the PHP version?
Almost 70% of website owners use the PHP language to build their websites. PHP acts as glue and sticks your WordPress structure together. Therefore, its best to know how important PHP is on your WordPress website. Below we mentioned how important PHP actually is:
- PHP displays your web pages to your visitors.
- Using and editing PHP is very simple even for beginners.
- With only a few lines of code, you can manage and change your website.
- It’s an open-source language.
- You can run it on several web pages.
- PHP is compatible with Windows, Linux, macOS, and UNIX.
Check the WordPress PHP version with a plugin
By using Display PHP Version plugin, you can easily check your WordPress PHP version. From your WordPress dashboard click on Plugins. Then, click on Add New and in the search box search for Display PHP Version plugin and proceed to install and activate it.
Now from your WordPress dashboard click on At a Glance to check your WordPress PHP version.
Check WordPress PHP version from cPanel
Enter your cPanel account. From your cPanel dashboard, locate Services section and click on Select PHP version.
Once you click on it, you will be redirected to a new page where you can view your current PHP version and change your PHP version.
Check PHP version with phpinfo() function
phpinfo() is a function used in PHP. This function saves and displays information about your server, PHP platform, OS version, PHP add-ons, PHP permissions, etc. To run this function, you need to create a file. You can name it anything you desire. For example, test.php and upload it to your website’s root directory. Open the file with an editor and type in the code below:
Finally, save the file.
Now go to your website’s URL http://yourwebsite.com/test.php This URL would run the file and function you have created and you will see a lot of information as well as your current PHP version.
Why do you need to check and update the PHP version?
As we mentioned above, your WordPress website is being run by PHP. So, PHP plays an essential role in your website’s core and functionality.
In reality, PHP acts as a converter. It takes your information from the database and displays it to your users with the help of HTML and CSS. Therefore, if PHP is not working correctly, you will have issues on your website.
Programming languages are constantly being updated. Therefore, using the latest version can increase your website’s security and performance.
The difference between PHP versions in WordPress
To have a better understanding of PHP, we will discuss the differences between PHP versions. To run WordPress you need to have PHP version 5.2.4. However, some plugins won’t work with version 5.2.4. Therefore, if you are using PHP version 5.2.4 we recommend you to update it.
PHP 5.4 was a huge improvement in speed. Up to this day, this version has the best performance in WordPress. In addition, it requires less space compared to other versions and as a result, it is still popular in the WordPress community.
PHP version 5.6 has the best support in WordPress, and almost half of WordPress users use PHP version 5.6. Famous hosting providers offer PHP version 5.6 to their users. However, WordPress users are in the middle of transferring from PHP version 5.6 to PHP version 7. PHP version 7 is the best PHP version. This version was published at the end of 2015 along with a newer version of Zend Engine (an open-source scripting engine for PHP files).
How important is updating to PHP version 7?
PHP version 7 has brought better user experience for WordPress users. Once you transfer from PHP version 5.6 to 7 you immediately notice the difference in your website’s performance.
Some WordPress users strongly believe that their website’s speed has been doubled ever since they switched to PHP version 7. Once you update PHP version, your server can present your website to more people at once.
In PHP version 7, you can assign your variables to different data and ultimately this will reduce mistakes and reading your codes are simplified.
In addition, managing errors have never been easier and you have the ability to fix occurred errors in your script without shutting down the whole application. This is good news for everyone because the chance of them visiting a broken website is almost non-existent.
Spaceship Operator is a new feature added to PHP version 7. This is a new operator for combined comparison and it can be used on all generic PHP values with the same semantics as <, <=, ==, >= and >.
Let’s not forget that PHP 7 has much better security layers. So, hacking websites running on PHP version 7 is much harder than before.
Keep in mind, old PHP versions are outdated and may no longer be supported. As you may already know, there is no security support for PHP version 5.6.
Check PHP version compatibility with WordPress
Before you update PHP version from 5 to 7, it is recommended to check if your plugins and themes are compatible with PHP version 7. To check their compatibility, you can use PHP Compatibility Checker plugin.
After installing and activating the plugin, click on PHP Compatibility in your WordPress tools. Configure your plugin to check your website’s compatibility with different versions of PHP.
You can select plugins and themes you would like to check with PHP 7. Once you have selected your plugins and themes click on Scan site. Finally, the report page is displayed to you. As long as you are using verified and premium plugins and themes you have no issues using PHP version 7.
How to update WordPress PHP?
Before updating your PHP version, it is highly recommended to get a backup of your website.
The issue you may face while updating your PHP is the incompatibility of your old codes with the new PHP version. Therefore, you need to keep your WordPress updated at all times. First, backup your website and then update your WordPress.
Update PHP version through cPanel
If you are using a web host that gives you access to cPanel, then you can easily change your PHP version. From the Softwares section, click on Select PHP version.
In the newly opened page, select your desired PHP version and click on Set as current. Refresh your website and make sure everything is working as intended.
You can also select which add-ons you want to activate on the new PHP version. To do so, in your cPanel and in the select PHP version section you can check your desired add-ons and click on save.
Update PHP version in Plesk
You can install PHP versions through Plesk panel. To do so, connect to your server or run a command on your Plesk.
To go through the server, make sure port 8447 is open on your firewall. But if this port is closed and won’t open, follow the steps below:
- Go to tools & settings in Plesk and click on updates and upgrades.
- On this page, click on add/remove components.
- If you are using Linux, in the web hosting section click on PHP interpreter versions and if you are using Windows click on Plesk hosting feature.
- Select your desired PHP versions and either add or remove and click on continue.
- With RDP/SSH connect to your Plesk server.
- Create a list of Plesk components:
- Plesk installer –select-release-current –show-components
Extra PHP versions are known as components. You can either add or remove them.
For example, the command to remove version 5.6 and install 7.2 is:
C:\> Plesk installer –select-release-current –remove-component php5.6
C:\> Plesk installer –select-release-current –install-component php7.2
# Plesk installer –select-release-current –remove-component php5.6
# Plesk installer –select-release-current –install-component php7.2
Finally, it’s worth mentioning that PHP is an important part of your WordPress website. Using updated PHP increases the speed and performance of your website.
However, there are many users who would rather use the older versions of PHP. Because many website owners believe having a well-designed website is enough and they don’t bother updating their PHP versions.
In addition, plugins and theme developers believe that updating the PHP version is the most crucial factor to have a successful website.
YoastSEO is playing a crucial role and convincing WordPress users to update to the latest PHP version. In early 2017, YoastSEO published version 4.5 and with it, a notification.
In the notification, they asked users to update to the latest version of PHP and only by updating your PHP version you can remove the notification banner. However, all this effort is to make sure you update the PHP version which would increase the performance of your website.