Different results between phpinfo.php and php-v

I used appserv 5.8 and in my phpinfo.php the php version was 5.6.26 now I installed laravel5.5 and its required phpversion 7 so I changed the php version to 7 out of 5 now in my phpinfo.php

PHP Version 7.0.11 

and when I write in a team

 php -v 

give it to me

 PHP 5.6.26 (cli) (built: Sep 15 2016 18:12:07) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies 

and I can’t install packages with laravel 5.5 bc, the command line version is 5.6 not 7 but when I check phpinfo my 7 I read something that the php -v command sticks to the version from php-cli since I can change php - v on 7.0.1 like phpinfo.php thanks ..

+5
source share
3 answers

phpinfo.php shows which version of PHP Apache uses. -v indicates that in your $ PATH.

If you are on a Mac, I recommend using homebrew to install php 7 as described here

To clarify, PHP can be launched in three ways : behind a web server, for command line scripts, and for creating a GUI. You have 2 versions: the web server is the one that Apache calls and calls phpinfo.php , and PHP-CLI , which is called from the command line with php -v .

+3
source

Your CLI version for PHP seems to be different from the web version of PHP. Update your PHP CLI package.

+4
source

You have two PHP executables installed. On my Mac OSX:

 $ which php /usr/local/bin/php $ /usr/local/bin/php -v PHP 7.0.20 (cli) (built: Jul 12 2017 09:47:44) ( NTS ) 

And on the same computer:

 $ whereis php /usr/bin/php $ /usr/bin/php -v PHP 5.6.30 (cli) (built: Feb 7 2017 16:18:37) 

You should put / usr / local / bin in your PATH. Edit ~ / .bash_profile

 export PATH=/usr/local/bin:/usr/local/sbin:$PATH 

Open a new terminal and check your php version.

+2
source

Source: https://habr.com/ru/post/1271461/


All Articles