Home >Backend Development >PHP Problem >How to check php version
How to check the php version
Method 1: Command line query
If the environment variables have been configured, enter php -v directly on the command line, and the version information of php will be displayed. If you do not configure environment variables, directly enter the php installation directory on the command line, and then enter the command php -v. As shown in the figure, I enter the query command in the installation directory, and you can see that the output version information is PHP5. 3.29.
Method 2: Use the predefined constant PHP_VERSION to query
Create a new php file and enter
<?php echo PHP_VERSION; ?>
As shown below.
Output the corresponding URL in the browser, and you can view the PHP version information, as shown in the figure below.
Method 3: Use the phpversion() function to query
Create a new php file and enter
<?php echo phpversion(); ?># in the file ##Access in the browser, you can see the PHP version information returned on the browser page, which is the same as the predefined constant PHP_VERSION, as shown in the figure below
Method 4: Use the phpinfo() function to query
Create a new php file and enter<?php echo phpinfo(); ?>
## in the file #Access in the browser, you can see not only the version information of PHP, but also a lot of other information about PHP, as shown in the figure below.
For more PHP knowledge, please visit
PHP TutorialThe above is the detailed content of How to check php version. For more information, please follow other related articles on the PHP Chinese website!