To check the version of PHP installed on a Linux or Unix server, you can use one of the following methods:
Run the php -v command in the terminal. This will output the version of PHP installed on your server.
Create a PHP script with the following code:
<?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.
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.
/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.