Changing the php version in Laravel Sail
[00:00] Laravel Sail works with php 8.0 or php 7.4. If I type in sail php -v
and hit enter, we'll see that by default, Sail applications are set up to use php 8. But what if, for some reason, we need to use php 7?
[00:21] Before you change anything, make sure to stop sail using sail down
, then open the docker-compose.yml
file and make the following changes: here, under laravel.test, build, context, make sure you change to runtimes/7.4
and then do the same for the image. Instead of sail-8.0
, do sail-7.4
and save.
[00:55] Once you've done that, go inside the terminal and run the following command: sail build --no-cache
. This will rebuild your container images.
[01:11] Finally run the sail up
command to start sail again. And now if we type sail php -v
again, we'll see that our new php version is 7.4.
-
1Setup a new project using Laravel Sail (macOS)02:33
-
2Executing commands inside your application containers02:20
-
3Creating a database client connection01:30
-
4Testing emails with Mailhog02:35
-
Changing the php version in Laravel Sail01:29
-
6Run Sail and Valet in parallel01:39
-
7Customizing Laravel Sail01:25
-
8Setup Laravel Sail for an existing Laravel application00:49
-
1Setup a new project using Laravel Sail (macOS)02:33
-
2Executing commands inside your application containers02:20
-
3Creating a database client connection01:30
-
4Testing emails with Mailhog02:35
-
Changing the php version in Laravel Sail01:29
-
6Run Sail and Valet in parallel01:39
-
7Customizing Laravel Sail01:25
-
8Setup Laravel Sail for an existing Laravel application00:49