即使我的php版本是7.2.1,在Laravel 6作曲家中更新php版本也出错

时间:2019-10-26 16:12:33

标签: php mamp php-7.2 laravel-6

我下载了一个laravel 6演示项目,并在我的Mac Mamp中进行设置。最初,我的php版本是7.1.23,但出现此错误。

Warning: require(/Applications/MAMP/htdocs/laravel_demo/public/../vendor/autoload.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/laravel_demo/public/index.php on line 26

Fatal error: require(): Failed opening required '/Applications/MAMP/htdocs/laravel_demo/public/../vendor/autoload.php' (include_path='.:/Applications/MAMP/bin/php/php7.2.1/lib/php') in /Applications/MAMP/htdocs/laravel_demo/public/index.php on line 26

因此,我通过在Mamp中重命名旧的php版本文件夹,将php版本更改为7.2.1。现在,如果我运行phpinfo(),它将显示php版本7.2.1。但是,当我在终端中运行composer update时,出现此错误。

Problem 1
- This package requires php ^7.2 but your PHP version (7.1.23) does not satisfy that requirement.
Problem 2
- laravel/framework v6.4.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.3.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.2.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.1.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.0.4 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.0.3 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.0.2 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.0.1 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework v6.0.0 requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- laravel/framework 6.x-dev requires php ^7.2 -> your PHP version (7.1.23) does not satisfy that requirement.
- Installation request for laravel/framework ^6.0 -> satisfiable by laravel/framework[6.x-dev, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.2.0, v6.3.0, v6.4.0].

这个问题与laravel设置或我的php版本有关吗,还是我在更新php版本时缺少某些东西?

2 个答案:

答案 0 :(得分:2)

Laravel 6需要PHP> = 7.2.0,您的版本是7.1.23。

在这种情况下会发生什么?

如果您通过浏览器通过http服务器访问的文件运行// if a video exists, set it to the speed and give a notification function setSpeed(newSpeed) { var returnVal = getVideo(); var video = returnVal[0], type = returnVal[1]; if (video != null && type === "main") { video.playbackRate = newSpeed; inWindowAlert("Speed: " + newSpeed, 1000); setIcon(newSpeed); } if (parent === top) { if (video != null && type === "iframe") { video.playbackRate = newSpeed; inWindowAlert("Speed: " + newSpeed, 1000); setIcon(newSpeed); } } } 。您的终端的输出可能会有所不同。如果在HTTP服务器上启用的PHP(例如apache或nginx)是最新的(7.2),则可能是在运行phpinfo()的终端中检查版本的。

在某些情况下,php已更新为http服务器,但是“ cli”版本未更新并且指向较旧的版本,这取决于系统的更新方式。

在这种情况下,您需要检查php -v是否正确安装。

答案 1 :(得分:0)

Laravel 6是必需的PHP版本是PHP> = 7.2.0。 您的版本是7.1.23,这是较低的要求。

您安装了mamp 7.2或最新版本。