Skip to content

Conversation

@timacdonald
Copy link
Member

@timacdonald timacdonald commented Oct 22, 2025

When using php artisan serve with PHP_CLI_SERVER_WORKERS, the --no-reload flag must also be provided, otherwise the value is ignored (#54606).

Right now, there is no indicator to the user that the environment variable is being ignored and is a tough one to track down without doing some source diving.

We now output a warning to help you get back on track.

Without the flag

Screenshot 2025-10-22 at 14 29 57

With the flag

Screenshot 2025-10-22 at 14 30 09

@github-actions
Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@timacdonald
Copy link
Member Author

timacdonald commented Oct 22, 2025

I've just seen that PHP_CLI_SERVER_WORKERS=4 is the default in a new Laravel application.

https://github.com/laravel/laravel/blob/56c833e61f7897950ea4078fcdbd95cc12eb82f8/.env.example#L14

That means running php artisan serve will output this warning in a fresh application, which I don't love.

Any thoughts on how we can improve this situation? Maybe if we made it a little less in your face? Kinda weird that we set this default but then it can't be used unless you know this workaround.

@timacdonald timacdonald marked this pull request as ready for review October 22, 2025 03:38
@taylorotwell
Copy link
Member

Hmm, yeah - not sure I have any great ideas there other than moving default away from 4. 😕

@timacdonald
Copy link
Member Author

timacdonald commented Oct 22, 2025

Thought about this some more and I think we can make this a good experience.

For new projects, we currently set the default to 4.

A new application runs php artisan serve or composer dev and they will only run one worker because they didn't use --no-reload.

So in reality the default is PHP_CLI_SERVER_WORKERS=1 for new developers and new applications.

I propose we keep the .env.example variable in place but comment it out. New applications would continue to work as they do now, i.e., they run one worker. If the environment variable is un-commented, the warning will start to appear, which is useful to both new and experienced Laravel developers.

See: laravel/laravel#6693

The only bummer is that it will start appearing for existing applications running those commands.

It seems, for some reason, that this restriction doesn't apply to Sail, so I'd propose we add PHP_CLI_SERVER_WORKERS=4 either to the .env during the Sail install process or add it to the docker-composer.yml file under the environment key.

Reckon that could do it?

@taylorotwell taylorotwell merged commit ebcb746 into laravel:12.x Oct 23, 2025
68 checks passed
@taylorotwell
Copy link
Member

Yeah that seems fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants