Getting old php version while installing Laravel

I’ve installed two xampp in different drives(windows) as follow:

Drive G: xampp (php 5.6)
Drive C: xampp (php 7.2)

I’ve also set environmental variable to php 7 drive in PATH variable. But still getting error during installing latest laravel that:
This package requires php >=7.0.0 but your PHP version (5.6.35) does not satisfy that requirement.

When I run following command in CMD it also shows php 5.6.3:
php -v

System is restarted, CMD is restared, what else I missed or have to do so that I can get latest PHP version? The strange thing is that when I run php file in xampp with 7 version it shows PHP 7.2.4 in phpinfo().

Note: I do need php 5.6 for other old projects that’s why I can’t delete second xampp.

enter image description here


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I am not sure which windows you are using but as i think it is window 10

Make Sure you are adding PATH in your case C:xamppphp in system variables instead of user variables

and try to run ECHO %PATH% in cmd and check if there is path added for PHP 7 not 5.6

Method 2

If your using linux just update your default php

sudo update-alternatives --set php /usr/bin/php7.2

If your using any other operating system then check how to set default version.

For windows:

Download php from and extract it to C:xamppphp7.2 and set this path.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x