Arslan Ahmad khan
Arslan Ahmad khan

Reputation: 5814

how to check if there are multiple versions of php in windows10 need 7.1 for laravel packages?

I have downloaded two versions of PHP 5.6.35 and 7.1 set there environment variables but each time i run command to check versions

php -v

it gives 5.6

I need 7.0 for laravel packages but my wamp server requires 5.6.

i set the path variable of both . but when i use in project it give's eror

doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.25) does not satisfy that requirement

any help

Upvotes: 0

Views: 1012

Answers (2)

Raza Mehdi
Raza Mehdi

Reputation: 941

You can install multiple versions of php in Windows. But you need to do the following every time you need a run a project which supports a specific PHP version:

  • Enable php module for Apache/Nginx etc.
  • Add php executable path to global PATH variable, and remove references to old path.

Have a look at this answer on how to automate version change on Windows.

Upvotes: 1

vstelmakh
vstelmakh

Reputation: 772

You get 5.6, because it set in your PATH system variable.
If you need an additional 7.0, you could download it and use full path to php.exe to execute it.

Example:

C:\php7\php.exe -v

Or you could change PATH to php 7 directory. Then you will be able to run it with only php command. In this case, to run php 5.6 you will have to use full path to it. Don't forget to logout/reboot the system to apply the PATH variable changes.

Set only one version of php to PATH because system runs the first founded php.exe, in your case this is php 5.6.

Upvotes: 3

Related Questions