Closed Radiergummi closed 1 month ago
Thanks for submitting a PR!
In order to review and merge PRs most efficiently, we require that all PRs grant maintainer edit access before we review them. For information on how to do this, see the relevant GitHub documentation. Additionally, GitHub doesn't allow maintainer permissions from organization accounts. Please resubmit this PR from a personal GitHub account with maintainer permissions enabled.
@Radiergummi : I am running into the same issue as https://github.com/dunglas/frankenphp/issues/931. What's the status of this PR? Was the issue fixed elsewhere in the meantime?
Edit: It seems there is an updated PR at https://github.com/laravel/octane/pull/932.
@miguno that one's on me—it took me some time to implement some required changes—sorry. As soon as the updates have been reviewed, this should be working!
No worries, thanks a lot for your work on fixing this problem!
This PR updates the FrankenPHP configuration to disable worker mode if the application is running in the
local
environment and the worker count is not specified explicitly (or set toauto
).The problem
FrankenPHP's Worker mode keeps the application in memory, which does wonders for performance when running in production. Locally, however, it causes problems with XDebug, and does not reflect file changes immediately. The solution to the latter is configuring Octane to restart the worker after every request, thereby defeating most of the advantages of an application server in the first place.
The solution
By only enabling worker mode if the application is running in a non-local environment, it will be served in a CGI-like manner, i.e. what the built-in PHP server (used in
artisan serve
) does—and exactly what you'd expect to happen: XDebug just works, and changes to files are reflected immediately.In production, worker mode will be enabled and all the benefits that come with it apply. We use the setup as provided in this PR in our production application and don't face any issues with it.
This solves https://github.com/dunglas/frankenphp/issues/931, and probably solves #928 too.