Lets explore ways to check your WordPress’s PHP version or check PHP version on your Hosting account, so you know what you are getting into, Below highlights:
What is PHP?
As per PHP’ own website PHP is “a popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.” In other words, “PHP (recursive acronym for PHP: Hypertext Pre-processor) is a widely used open-source general-purpose scripting language that is especially suited for web development and can be embedded into HTML”
PHP is successor of PHP/FI a product created by Rasmus Lerdorf in 1994 for personal project aka “Personal Home Page Tools”. Later, in 1995 the source was released which allowed anyone to provide bug fixes, provide improvements, add features.
If you are running a website, blog, or Ecommerce store on WordPress, it is thanks to PHP, almost ~60% of the WordPress code is written in PHP. Now considering that it plays a significant role in your sites functionality it is important to know what version of PHP you are running and what WordPress supports which all version of PHP.
How does PHP work?
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html>
Although PHP is far more advance and features rich language by with you can create server-side scripting, command line scripts or even write desktop applications. Moreover, PHP is supported on wide range of Operating systems, along with that PHP also supports wide range of today’s web-servers.
PHP being feature rich, it’s also simple for newcomers, which means you start learning PHP now and would be able to write your own PHP script within few hours. Learn PHP today here or if you want to get involved in community start getting involved in PHP conferences or local meetups
What all programming languages are used in creating WordPress and how much does PHP contribute?
Which is the current version of PHP and which version does WordPress Support?
Why do you need to know current version of PHP and what version is used /needed by WordPress because as you already know WordPress depends on it, while if you or your host is running old, outdated version of PHP, the WordPress website, blog, online store might not run as expected.
As of this writing the current stable version of PHP is 8.1.XX. As per WordPress website, WordPress works with any PHP version which is either 7.4 or greater. Although today also many WordPress based websites runs on outdated PHP versions 5.2 clearly making them targets for security vulnerability. Hence if you or your host is running any version below PHP 7.4 WordPress website might work, but your website might be in the risk zone. Hence, it’s better to upgrade to PHP 7.4 version for your WordPress needs. As of now as per the stats from WordPress, almost 49% of total website running WordPress uses PHP version 7.4
Now the real question comes to mind is how to check which version of PHP you / your host is running?
How to check your current version of PHP for WordPress? or How to check WordPress PHP version?
There are multiple ways you can check which version of PHP is running on your server, lets take a look at top 4 ways for the same:
- Ways to check WordPress PHP version for your Hosting account or server
- Use the WordPress Site Health Tool from WordPress Dashboard
- With PHP code file by uploading and executing the same
- Using Hosting Control Panel
- Use a WordPress Plugin – Two Plugins
Let’s start from the bottom:
4. Use the WordPress Plugin to check the PHP version used by your WordPress installation.
While looking for plugins to check PHP version I was able to find 2 plugins which will display PHP version in Admin Dashboard for you after installation and activation.
The first plugin is Display PHP version , As per plugin documentation you just have to install and Activate, once you do so you would be able to see the PHP version under “At a Glance” under WordPress Dashboard.
The second plugin is version info , As per plugin documentation you just have to install and Activate, once you do so you would be able to see the PHP version under the right hand corner of WordPress Admin Panel pages.
3. Using Hosting Control Panel
If you do not wish to go plugin way than, you can use Host provided control panel to check and verify the current version of PHP.
Majority of the host providing shared hosting, WordPress hosting uses cPanel, although there are other Web hosting panel, we are only providing steps for cPanel here for now, other panel steps can be added later based on demand.
With cPanel, once you are logged in to your account search PHP in the global Search bar normally located at top and from the results select “Select PHP Version”
Or search for the Software Section in your cPanel, from where you can choose “Select PHP version”
Which will take you to “PHP Selector” Screen, on which the current PHP Version will be display.
2. With PHP code file by uploading and executing
If you do not have access to install plugin and check for the PHP version or you think installation of plugin is too much for a simple task like checking current PHP version than you can write and upload the code in a PHP file which will display current PHP version.
Create a file locally named “checkphpversion.php” with below code on your local machine.
<?php phpinfo(); ?>
After you save the newly created file, upload the same to your hosting accounts “public_html” folder.
Or if you have access to the File Manager under cPanel you can create the file directly into the “public_html” folder with code above. Difference here is you will have to first create a file and later edit the file to add above code to the file.
Once the file is in the public_html folder, you can open browser on your local system and navigate to “www.yoursite.com/checkphpversion.php” which will display lot of information about PHP and server but above all it will display default PHP version currently in use. We recommend removing the newly created file or remove the code above from the newly created file, once you have completed validating / checking PHP version for your WordPress installation.
1. Use the WordPress Site Health Tool from WordPress Dashboard
This is the easiest method to check PHP version used by WordPress current installation. Starting from WordPress version 5.2, WordPress provides site health tool built-in which provides recommendation for improvement and lots of information about the server, WordPress installation and also PHP version information.
To check your current PHP version with Site health, You can navigate to the WordPress- > Tools -> Site health -> info -> Server
How to change PHP version?
The easiest and most popular way to change PHP version is from the Hosting Control panel. The hosting control panel takes care of all the other variables which needs tuning /change when you change PHP version.
Changing PHP version:
To change PHP version of your WordPress website we recommend following steps:
1) Backup of existing Website.
Before we go into details of how to change PHP version of your WordPress website using Hosting control panel, we would recommend taking a full site backup which should include all the WordPress files and folder and database. If you are don’t know how to take backup of your WordPress website, we recommend using Updraft plus plugin to take backup.
2) Change PHP version:
We are following here cPanel steps to change PHP version :
Search for the Software Section in your cPanel, from where you can choose “Select PHP version”
On the resulting screen you will see “Current PHP version” click on the version number and from the resulting drop-down select the appropriate version you need. Click on “set as current” and let the control panel complete the steps required.
3) Check your website thoroughly
Check your website thoroughly for usability, links, forms to validate if all the functionality works on the website as before after the version check, this is to ensure your website is not broken after PHP version change.
Getting to much on the plate ? We do offer awesome WordPress website management and support services. You can focus on business , while we take care of your WordPress website. Check out our WordPress support plans.