PHP is arguably the world’s most popular web-oriented programming language. Countless websites on the internet built with PHP. Not to mention content management systems like WordPress and Joomla. They are also written in PHP.
Speaking of PHP, did you ever wondered what version of PHP you have on your server?
The use of PHP is often paired with database management systems like MySQL. At the time of writing, PHP has come to version PHP 7.1. There are two ways to check PHP version on your server, depending on the type of server your use.
1. Check PHP version via terminal
If you have a VPS server (or dedicated may be) where you should have the terminal access, you can effortlessly check the PHP version by typing php -v
on the terminal. That command will show the output like the following.
2. Check PHP version via a file
If you have no access to terminal to run the command above, you can use this second method. You can use this method if you subscribed to a shared hosting service where you typically have no terminal access. Most hosting providers provide web panel which usually has a file manager. You can make use of the file manager to create a PHP file to check the PHP version on your server. You can name the file as you want, but always remember to add the “.php” suffix. Following is the content you should be adding.
<?php phpinfo(); ?>
You can both use the editor of the web panel or create the file offline using your favorite editor and upload it later. One thing, you should add the file on the root directory of your website (or anywhere as long as you can recall the path).
For example, I created the “phpversion.php” file and put it to the root directory of my website. So, I need to type “mywebsite.com/phpversion.php” on the address bar of my browser. Here is the output.
As you can see from the screenshot above, the PHP version is displayed at the top-left corner of the page of the file you have created.