Solution to inconsistent php-v version: 1. Check the location of your php through "find ./ -name php"; 2. Enter ":export PATH="/usr/local/php" on the command line /bin:$PATH""; 3. Add global variables in the "/etc/profile" file.
The operating environment of this tutorial: Windows 10 system, php7.1.7 version, DELL G3 computer
What to do if the php-v version is inconsistent ?
The problem of inconsistent versions between using php -v and phpinfo()
1. Why does this problem occur?
1.1 php -v is to check the default php version of the Linux system, phpinfo() is the web version to run
If the default version is not modified to be consistent with the web version, the following problems may occur:
I develop a project with laravel under windows using php7.1.7 version, and then git it to the server. Composer install keeps reporting that the php version is not enough, but
phpinfo() can be seen on the browser. The one is php7.1.7;
Solution:
2. Check the location of your php7.1.7
find ./ -name php
I installed it using the lnmp integration package, so my web version is in the /usr/local/php directory
3. Enter on the command line: export PATH="/usr/local/php/ bin:$PATH"
4. Use php -v to check and find that the version is correct, and then the composer install project will not report that the version is insufficient
5. Note that this is only a temporary addition
Permanent addition:
Add global variables in the /etc/profile file
#vi /etc/profile
Add:
export PATH=/usr/local/php/bin:$PATH
Note: = There cannot be any spaces on both sides of the equal sign
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What to do if the php-v version is inconsistent. For more information, please follow other related articles on the PHP Chinese website!