在命令行中显示两个不同的PHP版本 [英] showing two different PHP versions in command line

查看:121
本文介绍了在命令行中显示两个不同的PHP版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 laravel 项目5.1,该项目工作正常,但是 artisan 命令无法正常工作,并抛出 php 7.1 中已弃用的> each()错误。当我运行 phpinfo()时,它显示 php版本5.6 ,并且在命令行上也显示了两个版本

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

运行时

phpinfo();
5.6

在xampp文件夹中的命令行上运行时

when run on command Line in xampp folder

C:/xampp> php -v;
5.7

在此xammpp / php目录中以命令运行时

when run in command in this xammpp/php directory

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


推荐答案

这是因为有 CLI版本 WEB版本

JakeGould怎么说:

How JakeGould says:


不要惊慌!如果您担心Apache服务器使用的PHP版本,那么phpinfo()的输出始终是您应该注意的地方。 Apache PHP模块和PHP命令行二进制文件是彼此不干扰的两个不同事物。

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.

实际上,您可以编译和加载要与Apache一起使用的各种PHP版本。只要您调整Apache以正确加载它。在Apache解析PHP页面的情况下,PHP命令行界面将永远不会发挥作用。

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.

PHP的命令行版本仅适用于特定于命令行的任务以及Apache的PHP模块永远不会触摸,使用或需要。

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.

来源: https: //superuser.com/a/971895

这篇关于在命令行中显示两个不同的PHP版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆