I have two php version-7.0.3 and 7.2.12. I want to keep both on my system. When i am installing laravel with command "composer create-project --prefer-dist laravel/laravel blog" it always picks php version 7.0.3, how can i force it to use version-7.2.12 and install laravel 5.7.*?
-
it requires different xampp or php versions as given on apachefriends.org/download.html so just download and install different version you wantAshish– Ashish2018-12-10 12:11:09 +00:00Commented Dec 10, 2018 at 12:11
-
Are you using Windows or Linux?Jerodev– Jerodev2018-12-10 12:13:26 +00:00Commented Dec 10, 2018 at 12:13
-
Linux(Ubuntu 16.04) with nginxmohsinhassan155– mohsinhassan1552018-12-10 12:14:01 +00:00Commented Dec 10, 2018 at 12:14
Add a comment
|
2 Answers
Use the php binary directly to run the composer command.
/usr/bin/php7.2 /usr/local/bin/composer create-project --prefer-dist laravel/laravel blog
The paths to the php and composer binaries might be different for you, make sure to check these first.
1 Comment
mohsinhassan155
i am getting error : Fatal error: require(): Failed opening required 'Composer/autoload.php' (include_path='.:/usr/local/php7212/lib/php') in /usr/bin/composer on line 8
First install needed php versions eg- 7.4 and 7.1 install both
then
sudo update-alternatives --config php
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/php.default 100 auto mode
1 /usr/bin/php.default 100 manual mode
2 /usr/bin/php7.1 71 manual mode
* 3 /usr/bin/php7.4 74 manual mode
4 /usr/bin/php8.0 80 manual mode
the switch to number what do you need.. example
4 then click enter