skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

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

    curl -s "https://laravel.build/example-app?with=mysql&php=74" | 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).

    Update: I originally thought adding a "laravel=8" to the curl command would load laravel in version 8.x, but this had no effect. Adding php=74 is enough to get laravel in version 8.x, but it does not set PHP to version 7.4. That needs to be done in the docker-compose.yml file.


  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search