简体   繁体   English

即使我安装了PHP7并将其添加为解释器,PhpStorm项目仍然使用PHP5

[英]PhpStorm project still using PHP5 even though I installed PHP7 and added it as an interpreter

I tried to run composer install on a project and received this error: 我试图在项目上运行composer install并收到此错误:

Problem 1 问题1
- This package requires php ^7.0.0 but your PHP version (5.5.12) does not satisfy that requirement. - 此软件包需要php ^ 7.0.0,但您的PHP版本(5.5.12)不满足该要求。

So I've installed downloaded the PHP 7 zip from php.net then followed this tutorial step by step until (and including) step 4 https://www.sitepoint.com/how-to-install-php-on-windows/ 所以我已经安装从php.net下载了PHP 7 zip然后按照本教程一步一步,直到(并包括)第4步https://www.sitepoint.com/how-to-install-php-on-windows/

Then at step 5 the commands didn't work and I stopped. 然后在步骤5,命令不起作用,我停了下来。 I've added PHP 7 as an interpreter in PhpStrom as seen in the picture below but when I run composer install again it still gives me the same error. 我在PhpStrom中添加了PHP 7作为解释器,如下图所示,但是当我再次运行composer install时,它仍然给出了同样的错误。

php解释器

Please advise me on how to fix this problem. 请告诉我如何解决这个问题。 Thanks in advance. 提前致谢。

The problem is not with PHPStorm but with your CLI. 问题不在于PHPStorm,而在于您的CLI。 You need to go to your console type "which php" and you will see from where PHP is executed. 您需要转到您的控制台类型“哪个php”,您将看到PHP执行的位置。 Setup your CLI PHP version as PHP7 and it will solve the problem. 将您的CLI PHP版本设置为PHP7,它将解决问题。

If you are on windows then you need to check from PATH variable where php.exe is located and change the path to PHP7 location. 如果你在Windows上,那么你需要从PATH变量检查php.exe所在的位置并更改PHP7位置的路径。

See also manual page about installation php on windows 另请参阅有关在Windows上安装php的手册页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM