Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

different result between phpinfo.php and php-v

Tags:

php

i was using 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 from 5 now in my phpinfo.php

PHP Version 7.0.11

and when i write in the command

php -v

its give 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 cant install the packages with laravel 5.5 bc the version in command line is 5.6 not 7 but when i check in phpinfo its 7 i have read something thats the command php -v tack the version from php-cli so how can i change the php -v to be 7.0.1 as phpinfo.php thanks ..

like image 528
Awar Pulldozer Avatar asked Sep 02 '17 21:09

Awar Pulldozer


2 Answers

phpinfo.php shows what version of PHP Apache is using. -v shows what's in your $PATH.

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

To clarify, PHP can be run in 3 ways: behind a web server, for command line scripting, and for GUI building. You have 2 versions: the web server one, which Apache is calling and invoking phpinfo.php, and PHP-CLI, which is invoked from the command line with php -v.

like image 160
Sam H. Avatar answered Oct 26 '22 02:10

Sam H.


It seems like your PHP CLI version is different than the PHP web version. Upgrade your PHP CLI package.

like image 43
Legoboy0215 Avatar answered Oct 26 '22 01:10

Legoboy0215