How to find out the version of PHP on the server?

Checking if PHP is enabled for the domain can be done in a fairly simple way. You must go to the root directory of the site, which is bound to a domain, and create an arbitrary file in it with the .php extension, for example, phpinfo.php, open it using any text editor and specify the following text in it:

<?php
phpinfo();
?>

After that, enter the domain and the name of the created file in the browser, as a result, if PHP is activated for your domain, a page with its version and all existing parameters will be displayed, an example of which is shown in the image below.

If the contents of the file were output in the browser, this means that for this domain, or for the web server as a whole, the PHP handler is not activated (installed) in the configuration.

Checking PHP version and parameters through the console

You can check the version of the installed PHP interpreter on the server with the following command:

php  -v

To check the modules installed in PHP:

php  -m

And in order to get information on both the version of PHP on the virtual VPS server and its parameters, you need to enter the command:

php -i

As a result, the phpinfo() function will work, which will display all the information about the parameters in the console. To make reading the results more convenient, you can redirect the output of the specified command to a file, for example, as follows:

php -i >> info.txt

As a result of this command, all the output will be written to the info.txt file.