PHP is a programming language with rapid growth. The language that is widely used to build this website has many versions. Therefore, when creating a PHP website, you also need to know the PHP version used.
This is because an error on the website may occur because the PHP version used is no longer supported. If that’s the case, the solution that needs to be done is to upgrade the PHP version. So, how do you check the PHP version on the website?
Calm! You’re in the right place, really. In this article, we will present several ways to find out the PHP version that you can try right now.
Curious right? Read to the end, ok!
Why You Should Know How to Check PHP Version?
As a programming language, PHP generally functions to create websites. Starting from static websites such as blogs and news portals, to dynamic websites, for example, online stores.
Well, PHP is a programming language that is diligent in releasing updates. When this article was written, the latest PHP version is PHP 8.1 which will be released on November 25, 2021. PHP 8.1 has several new features, including Readonly Properties and Never Return Type.
From there, it is important for you to check the PHP version on the website. The point is to make sure you are using the latest version of PHP. Because you will feel the following benefits after updating PHP:
- Security – The latest version of PHP can improve the security and stability of the website. You do this by fixing bugs, errors, or other configuration errors that can be a security hole for the website.
- Speed – the latest version of PHP also has better performance to speed up website access. For example, PHP 8.1 is proven to be 5-8% faster than PHP 8 .
- New Features – The latest PHP updates always bring new and interesting features. For example, PHP 8.1 features Enums, Fiber, and Readonly Properties that can add to the capabilities of the website.
- Support – PHP developers prioritize support for new versions of PHP. For example the JIT Compiler upgrade which is prioritized for PHP 8.1.
5 Easiest Ways to Check PHP Version for Your Website
There are many ways to check the PHP version on a website that you can try, including:
- How to check PHP version via cPanel Hosting
- How to see PHP version in WordPress
- How to find out PHP version via Pingdom
- How to check PHP version with XAMPP
- How to see PHP version via Command Prompt
Let’s practice right now!
1. How to Check PHP Version via cPanel Hosting
The first way to find out the PHP version is through cPanel hosting. You can try this method if your website is already online at a hosting service.
Well, here’s how to check the PHP version via cPanel hosting:
- Open your hosting cPanel. How to add /cpanel after your website URL. Or, visit Manage Hosting > cPanel > All Features. Then click Files > File Manager.
2. Click the public_html folder to enter that folder.
3. Create a new file. How to click File then fill in phpinfo.php in the New file name column . If so, click Create new file.
4. Edit the new file. The trick is to click the phpinfo.php file and then click Edit.
5. Write the script as below. If so, click Save Changes.
<?php phpinfo(); ?>
6. Access the file in a browser. The trick is to type yourdomain.com/phpinfo.php. You will see the PHP version used on the website.
2. View PHP Version in WordPress
Apart from using cPanel, you can also try to check the PHP version in WordPress . Namely, by using the built-in tool, Site Health. Even so, this method can only be done on WordPress version 5.0 and later.
Here’s how to find out the PHP version in WordPress:
- Open the WordPress dashboard, then click Tools > Site Health.
2. Click the Info menu . If so, scroll down and click Server.
3. You will find information on the PHP version used, as shown below:
3. Knowing the PHP Version through Pingdom
You can also find out the PHP version on the website with an online tool called Pingdom. The main function of this tool is actually to test website speed . However, it can also be used as a way to check the PHP version.
Well, how to see the PHP version with Pingdom as follows:
1. Visit the Pingdom page and write the website URL in the column provided. After that, click START TEST.
2. Please wait for the process. If so, scroll down to the File request section . You will see the PHP version as follows:
Even so, there are some website servers that hide PHP version information for security reasons. As a result, you can’t see the information, for example:
4. How to Check PHP Version with XAMPP
If your website is not online yet, you can check the PHP version through localhost’s help. There are many local server applications that can be used to view PHP versions, such as XAMPP .
Well, how to check the PHP version with XAMPP is as follows:
1. Open your text editor and create a new file. Then, write the following script:
<?php phpinfo(); ?>
2. Save the file with the name phpinfo.php in the C:\xampp\htdocs folder.
3. Open XAMPP Control Panel. Then click Start on the Apache module.
5. View PHP Version via Command Prompt
How to check the latest PHP version is to use a terminal application. Each platform usually provides a built-in terminal application, such as Command Prompt on Windows.
Here’s how to find the PHP version via a Command Prompt:
1. Open a Command Prompt, then run the php -v command .
2. You will immediately see the installed PHP version information, as follows:
Let’s Use the Latest Version of PHP!
You have learned how to check PHP version through several methods. After checking, you will know whether your website is using the latest version of PHP or not.
If not, it’s time to upgrade the PHP version. Because, the latest PHP brings many benefits to the website. Starting from increasing security, accelerating performance, to adding various functions through the presence of new features.
If your website is online, you can upgrade PHP through the hosting service you use. But first, make sure the hosting service supports the latest PHP.
Thus the article this time, hopefully useful. If you still have questions, don’t hesitate to ask in the comments column. See you again!