Home > Net >  Install an Older Version of Laravel with Sail
Install an Older Version of Laravel with Sail

Time:04-21

I have a server that is still running PHP 7.4.x

I, therefore, need to install laravel 8.x (the current version of laravel is 9.x) with laravel-sail. Since I don't have PHP running on the laptop I am using for development, I cannot install laravel with composer.

When I run the install command curl -s "https://laravel.build/example-app?with=mysql" | bash then laravel 9.x is installed.

How can I make laravel-sail install laravel 8.x?

CodePudding user response:

you can download Laravel 8 or other versions from laravel github repository and replace it with your local project on sail

be careful laravel Sail and related parts (docker-compose,...) should not be deleted

the second way is that clone laravel 8 from github repo and install sail into this project

https://laravel.com/docs/8.x/sail#installing-sail-into-existing-applications

laravel 8.6.12 github repo: enter link description here

CodePudding user response:

apokryfos's comment got me thinking and I tried the following curl command

curl -s "https://laravel.build/example-app?with=mysql&php=74&laravel=8" | bash

That worked. My composer.json looks like this

"require": {
    "php": "^7.3|^8.0",
    "fruitcake/laravel-cors": "^2.0",
    "guzzlehttp/guzzle": "^7.0.1",
    "laravel/framework": "^8.75",
    "laravel/sanctum": "^2.11",
    "laravel/tinker": "^2.5"
},

... and with sail up, I have a Laravel v8.83.9 up and running.

For some reason, the PHP version is still 8.1, but I can change the PHP version in the docker-compose.yml to PHP 7.4 and rebuild. With that, I have (PHP v7.4.28).

  • Related