How to Check and print PHP version installed On Linux / Unix Server

How to Check and print PHP version installed On Linux / Unix Server

To check the version of PHP installed on a Linux or Unix server, you can use one of the following methods:

  1. Run the php -v command in the terminal. This will output the version of PHP installed on your server.

  2. Create a PHP script with the following code:

refer t‮:o‬lautturi.com
<?php

echo "PHP version: " . PHP_VERSION;

?>

Save the script as php_version.php and then run it in your browser by accessing it via the URL http://your-server/php_version.php. This will display the PHP version installed on your server.

  1. Check the output of the phpinfo() function. You can create a PHP script with the following code:
<?php

phpinfo();

?>

Save the script as phpinfo.php and then run it in your browser by accessing it via the URL http://your-server/phpinfo.php. This will display a lot of information about the PHP installation, including the version.

  1. Check the configuration file. On most systems, the PHP configuration file is located at /etc/php.ini. You can open this file in a text editor and search for the version directive, which will indicate the version of PHP installed on the server.
Created Time:2017-10-28 21:38:57  Author:lautturi