Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

felixele217's avatar

Upgrade Laravel Project to PHP 8.2

Hey guys, I have a Laravel Project with the latest Laravel version and want to upgrade it to PHP 8.2

I am using the standard Sail features for all of my development configurations.

Help is appreciated :) Felix

0 likes
3 replies
felixele217's avatar

Thanks christian. The question was how can I install php 8.2 in my Laravel project, since currently Php 8.1 is installed. Do i just have to replace the Dockerfile and nothing else? As told I am using the standard stail procedures, where ./vendor/bin/sail up already builds and launches all necessary containers and I never configured the docker-compose.yml or the Dockerfile

bradsi's avatar

@felixele217 I've published the Docker files in my project, so might have a slightly different setup than you. But you should have a docker-compose file in your root directory.

Change context: ./vendor/laravel/sail/runtimes/8.1 to context: ./vendor/laravel/sail/runtimes/8.2

Also change image: sail-8.1/app to image: sail-8.2/app

The docs say you should run the following in your terminal: sail build --no-cache and then sail up -d

However this didn't change the PHP version for me. So I ran sail down -v and then ran the above two commands again.

Confirm your PHP version has changed with: sail php -v

Docs here for reference: https://laravel.com/docs/9.x/sail#sail-php-versions

6 likes

Please or to participate in this conversation.