Home  >  Article  >  Backend Development  >  How to check php version

How to check php version

藏色散人
藏色散人Original
2019-09-18 10:40:3625307browse

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.

How to check php version

Method 2: Use the predefined constant PHP_VERSION to query

Create a new php file and enter

<?php     
echo PHP_VERSION;
?>

As shown below.

How to check php version

Output the corresponding URL in the browser, and you can view the PHP version information, as shown in the figure below.

How to check php version

Method 3: Use the phpversion() function to query

Create a new php file and enter

<?php     
echo phpversion();
?>
# in the file

How to check php version

##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

How to check php version

Method 4: Use the phpinfo() function to query

Create a new php file and enter

<?php     
echo phpinfo();
?>

## in the file How to check php version#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.

How to check php versionFor more PHP knowledge, please visit

PHP Tutorial

!

The above is the detailed content of How to check php version. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to uninstall phpNext article:How to uninstall php