How to check PHP version number?

PHP provides several functions that depend upon the version number of PHP you are running. In situations, where you want to find the version number of PHP installed, you can use the following techniques.

Assuming that your web server has already been set up to support PHP, enter the following code in a PHP file e.g. info.php and put it somewhere inside your document root.

<?php phpinfo(); ?>

Now, visit the page from your browser by entering the URL to the page e.g. http://<domain name>/path/to/file/info.php

You’ll see a page with a lot of details about the current PHP setup on your machine. At the very top you should be able to find the version number of your PHP installation.

Assuming that the PHP interpreter is in your path, hence can be accessed by typing php on the command line. You can also run the following command to find PHP’s version number.

C:/>php –v

Did this tutorial help a little? How about buy me a cup of coffee?

Buy me a coffee at ko-fi.com

Please feel free to use the comments form below if you have any questions or need more explanation on anything. I recommend thoroughy testing on a production-like test system first before moving to production.