https://laravel.com/docs/8.x/sail#sail-php-versions
If the file is missing run php artisan sail:install
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I create my app via Terminal in MacOS by running the following command:
curl -s "https://laravel.build/example-app“ | bash
But the problem for me is that the app it generates only works with PHP 8.0.2 and I need PHP 7.4.
I don't know why, where or how my app is getting PHP 8.0.2 from. The PHP version on my Mac (php -v) is 7.1 and I can't see any PHP versions in Docker (I am new to Docker).
So my question is how can I build a Laravel app via MacOS Terminal that uses PHP 7.4? Or how can I change my existing app from PHP 8.0.2 to 7.4? Thanks.
https://laravel.com/docs/8.x/sail#sail-php-versions
If the file is missing run php artisan sail:install
@Sinnbeck Thanks - I have followed the documentation your linked to but it does not work - I still get this error when trying to access my app:
"Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2"."
@chesney98 are you sure you rebuild after changing it?
sail build --no-cache
sail up
@Sinnbeck i put that in terminal but nothing happens it says:
-bash: sail: command not found
@chesney98 just run it from vendor
./vendor/bin/sail build --no-cache
./vendor/bin/sail up
Or set up an alias https://laravel.com/docs/8.x/sail#configuring-a-bash-alias
@Sinnbeck So I edited my docker-compose.yml file and changed the PHP version to 7.4 (in the context and image lines), I saved the file and then I navigated to my Laravel project folder in Terminal and ran those vendor commands you gave me - this time, a lot of stuff happened in the Terminal so it must have worked, but when I visit my app i the browser, it still says “Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.2” so the PHP version has not changed…. I am at a loss of how to resolve this and it is frustrating that it should be this complicated. I appreciate your help.
@chesney98 no the error says "Your Composer dependencies require a PHP version ">= 8.0.2". So that means you need php 8.0 but you have a lower version. So the issue is with your dependencies not sail. Maybe explain why you want 7.4?
@Sinnbeck Yes I want to run the app on PHP 7.4, not 8. But everytime I create a Laravel project in Terminal, it makes it with PHP 8, which I do not want.
@chesney98 so you have an existing laravel app you want to use? If so, install it inside of the app. Don't make a new one https://laravel.com/docs/8.x/sail#installing-sail-into-existing-applications
All I want to do is make a Laravel project that uses PHP 7.4. It's taken me over 1 week so far. I hope to write my first line of code by Christmas.
@Sinnbeck I am editing the existing app (or at least trying to but it is not solving my problem)
@chesney98 maybe just use valet as I suggested below. It is made for Mac and getting up and running fast
And you are said you are using curl -s "https://laravel.build/example-app“ | bash which is for making a new app.
@Sinnbeck I will look into Valet tomorrow. I am not using that "build" command when trying to edit my existing one. What I meant is that whenever I do use the "build" command, it makes an app that requires PHP 8 - I have no idea why it uses PHP 8 because I do not have PHP 8 installed anywhere. I am losing my patience with Laravel - I know how to code within Laravel, but I have never created my own app from scratch and it seems to be a completely ridiculous process. Easy when you know how I guess.
@chesney98 well 8.0 is the newest stable version so it makes sense to always start new apps with that version. It does not check your system or anything as sail uses docker. That means you don't need php locally at all
But to work with an existing app you just install sail inside that project, publish the docker-compose file and edit it. And then start docker (sail up)
This sadly needs composer locally at the time of installation. Perhaps that will change in the future
composer require laravel/sail --dev
php artisan sail:install
//edit the php version in docker-compose
./vendor/bin/sail up
But as I said, you should check out valet. It would be my choice if I used a Mac
@Sinnbeck The problem with Laravel for newcomers like me is that you have to learn a load of other stuff before you can even get started (sail, valet, artisan, composer, terminal, docker, homebrew). It's complete information overload and incredibly frustrating. I appreciate your help though - I will no doubt be back tomorrow with more questions about Valet...
@chesney98 yeah it can be a bit daunting to work with modern php frameworks like laravel or symfony.
If you want simplicity you can install the needed php version locally and then download the composer.phar to the project directory. Then run ./composer.phar install. And then run php artisan serve. Now the site is running using just php
Sail is the newest way of running laravel and uses docker. It can be a bit hard to learn though. It is probably the hardest way of using laravel if you haven't used docker before
@Sinnbeck So I have installed Valet but when I type laravel new test-project into Terminal, it says this:
Client error: GET cabinet.laravel. com/latest.zip resulted in a 404 Not Found response:
404 page not found
That zip file doesn't exist...do you have any ideas please?
I had to slightly edit the URL in the code above because I am new here and it wouldn't let me post it
@chesney98 why are you again trying to make a new project? If valet is installed then cd into the folder with your projects and "park" the folder. All subfolders will then be accessible with valet https://laravel.com/docs/8.x/valet#the-park-command
Or go into the project directory and link it https://laravel.com/docs/8.x/valet#the-link-command
@Sinnbeck Yes I have parked a folder and can access it in my browser using project-name.test. So how can I change the PHP version of my application to 7.4? I just want my project to work on PHP 7.4. It shouldn't be this difficult....
@Sinnbeck I have managed to downgrade PHP to 7.4 in my project folder by using the "valet use [email protected]" command. Now my project has stopped working (as expected) because it was built with PHP 8.0.2. Please, how can I complete the final step and make my project use PHP 7.4 and not 8.0.2?
@chesney98 Why was it built with 8.0? I thought you said it was an existing projekt? If it is a brand new one, I really dont understand why you would want to use php 7.4?
I also just tried making a new laravel project with composer, and it seems to work just fine with php7.4
composer create-project laravel/laravel my-awesome-project
@Sinnbeck Several reasons - primarily IonCube.
Also eveywhere says to run xxx command but I have no idea where or how to do this. I followed the documentation to build my application using Terminal on MacOS and the documentation commands don't make sense here. Am I supposed to build the application another way? If so, why does Laravel installation guide say you can do it via Terminal on MacOS? It has taken me several days already to get going with Laravel....it isn't easy.
Maybe consider using valet instead of sail? It requires no docker knowledge as it uses your local php version, but makes switching easy https://laravel.com/docs/8.x/valet
It's funny how no one here can explain how to make a new Laravel project that is compatible with an older version of PHP....
Solution: Abandon all your plans and work only with the PHP version that Laravel forces upon you...
I recommend you watch some of the beginner videos here at Laracasts rather than ignore @sinnbeck's advice
@lancashireman I didn't ignore their advice - I took, was grateful and said thanks - but that doesn't change the fact that Laravel is a convoluted nightmare for people who are brand new to it....most tutorials and documentation assume that you already have more knowledge than you actually do. Just because someone is proficient in PHP, it does not necessarily mean they are also proficient with terminal/composer/homebrew/sail/valet/artisan).
@chesney98 the tutorials are designed to help you when you don't know something. Next you're going to be blaming Laravel for not teaching you how to operate a web browser so you can access the documentation.
Watch this tutorial: https://laracasts.com/series/setup-a-mac-for-development-from-scratch
Please or to participate in this conversation.