-1

Many of us have the problems installing Laravel 10 via composer without using sudo update-alternatives --config php.

Default command from Laravel website does not work if you default php version is lower the php8.1 and you want to keep your old php7.4 version.

So if you run composer create-project laravel/laravel example-app and you have php7.4 ... the Laravel 8 will be installed.

That's why I post here my solution.

Florin
  • 5,781
  • 2
  • 20
  • 30
  • 2
    You could also simply call `sudo update-alternatives --config php` and set the right php version – Aless55 Feb 28 '23 at 19:06
  • 1
    Worth nothing that the `update-alternatives` command is only for Debian based Linux, though other Linux distributions generally have their own equivalent e.g. RedHas has the `alternatives` command and others you can just install the Debian one and it could work – apokryfos Mar 01 '23 at 06:05
  • 1
    "That's why I post here my solution." - so, you don't even have any specific question? Running Composer with different PHP versions has been asked many times before – Nico Haase Mar 01 '23 at 07:17
  • @Aless55 that's the idea to NOT use: sudo update-alternatives --config php ... I want to keep my default php7.4 ... – Florin Mar 01 '23 at 15:31
  • @NicoHaase please read carefully the title and the issue. Thanks – Florin Mar 01 '23 at 15:31
  • 1
    So, is this in any way a different problem than the one posted at https://stackoverflow.com/questions/32750250/tell-composer-to-use-different-php-version? – Nico Haase Mar 01 '23 at 16:30
  • @NicoHaase I consider it is. As you can see I have top answer over there. ... – Florin Mar 02 '23 at 17:24
  • If this is not the same problem, please share more details. How **exactly** is this different to the other problem? In both cases, running Composer with a different PHP version than the default one resolves the problem – Nico Haase Mar 03 '23 at 07:25
  • The enounce of the problem show exactly the difference. If you think is the same I please you explain why do you think is the same. – Florin Mar 04 '23 at 08:10

1 Answers1

-2

Here is what I use to install Laravel 10 via composer:

/usr/bin/php8.1 /usr/local/bin/composer create-project laravel/laravel futures

Considering you have php 8.1 installed. This works on Ubuntu 18.04

Florin
  • 5,781
  • 2
  • 20
  • 30
  • 1
    Please do not duplicate existing answers - this looks pretty similar to https://stackoverflow.com/a/52146990 – Nico Haase Mar 01 '23 at 16:31
  • My friend is not the same problem. As you can see I answered (I have the top answer ) in that link. but anyway. I'll keep this for me. – Florin Mar 02 '23 at 17:22