Do you need to know what version of PHP you are running on a web server? Here is a quick couple of ways to find out:
First and sometimes the easiest method if you have FTP access or cpanel access, is to upload a php info file to the server. By “php info file” I refer to a simple file with a call to the phpinfo() function. To make one, just copy and paste the following code into a file and name it info.php:
That’s it, just upload the info.php file with above content in it to your root directory or wherever you like and open the file in a browser by going to example.com/info.php and it will tell you right in the heading what version of PHP you have! See below illustration for clarification:
Want another way? You got it! Try adding this to the top your PHP info.php file. The following code uses the phpversion() function to return the version of PHP you are using:
echo ‘Current PHP version: ‘ . phpversion();
echo “<hr />”;
add the above code just after the opening php tag and upload to the server and open the page again and you will see a line of text before the regular php info that says what version of PHP you have as long as this fuction is supported by your web server which it should.