[12.x] Fix serve command ignoring PHP_CLI_WORKER_SERVERS env#54972
[12.x] Fix serve command ignoring PHP_CLI_WORKER_SERVERS env#54972tonysm wants to merge 4 commits intolaravel:12.xfrom
PHP_CLI_WORKER_SERVERS env#54972Conversation
|
During development, the ability to restart The only fix to prioritise |
|
@crynobone I understand your point. Personally, I depend way more on having multiple processes when using
Yeah, I explored sending a What if we displayed a "Automatic Reloading of Environment Variables is disabled." message when that behavior is disabled? |
|
Send a fix to hotwired-laravel/hotreload#2 Testbench handles this slightly differently, and would break with the above changes. |
|
Oh, thanks! The issue wasn't in the package itself, though. I noticed it in a Laravel app that was using the package, because the package requires more than one process due to the SSE route endpoint, and I found out it wasn't respecting the config for the number of procs. I updated the package docs to say "use the --no-reload flag" too. But this is also happening on Sail, for instance, since it doesn't default to using the |
I still believe environment reload should be prioritized (see comment above) as |
|
@crynobone what if we waited for the port to become available instead? I've updated the behavior to check for it. It should wait a few seconds (should be more than enough) for that to happen. If it doesn't, something is wrong so we throw an exception. |
|
After testing this, it doesn't seem the port will become available even after hours. Then I consider what's exactly running on the background: From the screenshot, it is clearly shown that |

Changed
servecommand withPHP_CLI_SERVER_WORKERS#54606, theartisan servecommand was changed to require a--no-reloadflag when using thePHP_CLI_WORKER_SERVERS. Instead of ignoring the config (which is the default in Laravel's scaffold), we can wait for the port to become available (for a few seconds) and throw an exception if it doesn't (clearly something went wrong and we can't recover)Related PRs:
servecommand withPHP_CLI_SERVER_WORKERS#54606Context:
As I was working on the Hotreload package, I noticed the processes were getting stuck by the SSE endpoint. Turns out there was only 1 process, even though we set the
PHP_CLI_WORKER_SERVERSin the default Laravel env.The current way it's working right now, we're ignoring the desired number of processes configured. With the changes here, we'd respect that but disable the auto-reload behavior. This is important for the Hotreload package, but also for Sail, since the
--no-reloadflag is not being used in the default command there.