How to check the PHP version on Linux

There are several possibilities to check and validate PHP version on Linux.

METHOD 1

Open a bash shell terminal and use the command “php –version”

METHOD 2

“php -v” to get the version of PHP installed on the system

METHOD 3

Let’s create a PHP file with content as shown below.
The phpinfo() function outputs a great deal of information about the state of the current PHP environment, including loaded extensions, compilation options, version, server information, and so on.

# echo "<?php phpinfo();?>" > /var/www/html/phpinfo.php

Now, considering that Apache is installed and working, open a browser and test PHP using address as follow:

http://server/phpinfo.php

We hope you’ve found this useful! 

Leave a Comment

Your email address will not be published. Required fields are marked *