showing two different PHP versions in command line

2019-08-19 22:57发布

I installed laravel project 5.1 which is working fine but artisan commands are not working throwing each() error which is deprecated in php 7.1. When I run phpinfo() it shows php version 5.6 and on command line there's also two versions are showing

when run

phpinfo();
5.6

when run on command Line in xampp folder

C:/xampp> php -v;
5.7

when run in command in this xammpp/php directory

C:/xampp/php> php -v;
5.6

1条回答
劳资没心,怎么记你
2楼-- · 2019-08-19 23:50

This is because there are CLI version and WEB version.

How JakeGould says:

Don’t panic! If you are concerned about what PHP version your Apache server is using, the output of phpinfo() is always what you should pay attention to. The Apache PHP module and the PHP command line binary are two different things that don’t interfere with each other.

In fact you can compile and load various PHP versions you want to work with Apache as long as you adjust Apache to properly load it. The PHP command line interface will never come into play in the case of Apache parsing PHP pages.

The command line version of PHP is simply there for command line specific tasks and the PHP module for Apache will never touch, use or need that.

source: https://superuser.com/a/971895

查看更多
登录 后发表回答