Search code examples
phpphpstormphp-7php-ide

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:

Problem 1
- This package requires php ^7.0.0 but your PHP version (5.5.12) does not satisfy that requirement.

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/

Then at step 5 the commands didn't work and I stopped. 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.

php interpreter

Please advise me on how to fix this problem. Thanks in advance.


Solution

  • The problem is not with PHPStorm but with your CLI. You need to go to your console type "which php" and you will see from where PHP is executed. Setup your CLI PHP version as PHP7 and it will solve the problem.

    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.

    See also manual page about installation php on windows