0

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.*?

3
  • it requires different xampp or php versions as given on apachefriends.org/download.html so just download and install different version you want Commented Dec 10, 2018 at 12:11
  • Are you using Windows or Linux? Commented Dec 10, 2018 at 12:13
  • Linux(Ubuntu 16.04) with nginx Commented Dec 10, 2018 at 12:14

2 Answers 2

0

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.