-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XDebug documentation #931
Comments
On browsing the XDebug issue tracker, there's a related issue:
Following that, Derick is just now implementing support for control sockets, allowing IDEs to inject new breakpoints into running PHP processes—such as the FrankenPHP worker. Edit: This is in no way meant to dismiss the amazing work of all FrankenPHP contributors. I'd just like to suggest clarifying the documentation on XDebug to make it clear step debugging doesn't really work for now, as the whole debugging story feels a little under-documented right now. |
There are a workaround for that: not using the worker-mode |
By setting max requests to 1, the synchronisation between the IDE and FrankenPHP is off-by-one—after setting a breakpoint, you need to request the old code once, the worker restarts and the breakpoint becomes active; after disabling the breakpoint, you again need to do an additional request, which triggers the (now-gone) breakpoint again, and only after that things are back to normal. However, disabling the worker mode is the way to go. This isn't as straightforward in Laravel Octane, which doesn't seem to anticipate someone might want to do this. By using a custom Dockerfile adapted from the one included with Octane, it's doable though. (worker) {
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
}
{
{$CADDY_GLOBAL_OPTIONS}
admin {$CADDY_SERVER_ADMIN_HOST}:{$CADDY_SERVER_ADMIN_PORT}
frankenphp {
{$CADDY_SERVER_FRANKENPHP_OPTIONS:import worker}
}
{$CADDY_GLOBAL_EXTRA_DIRECTIVES}
}
# (Rest of the default config below) All it requires you to do locally is set the Thank you for pointing me in the right direction, the Symfony repository was very helpful. This is probably a Laravel issue after all, but I'm weary of Taylor silently dismissing PRs. This issue can be closed then, I guess. Again, thank you! |
As the co-author of the FrankenPHP support for Octane, I'm probably the one to blame! IMHO a docs PR on Octane should to the trick. Or maybe an additional (temporarily) |
The issue is, in my opinion, that the default Caddyfile included in Octane always uses the worker mode. I don't know how others solve this, but I try to keep our development environment as close to production as possible, and thus also want to use Octane locally. I think the most Laravel-y thing would be to enable worker mode only if |
Actually the issue occurs only when using Xdebug, maybe could we detect if XDebug is enabled or something like that. |
@dunglas just so I can understand this correctly; from the default Octane config, FrankenPHP will start in worker mode, correct? So for changes made to the code to become live in development, users must set the maximum number of requests handled by workers to 1. |
Worker mode is an optimization, for now anyway. As more and more devs get used to working with it (like these changes to xdebug) this will become less truer over time. Generally, you disable optimizations (like a compiled container, etc) during development to make it easier/faster to get feedback loops and iterate. For now, there are things you have to manually do (kinda like not that long ago, we had to manually disable compiled DI containers in dev, now it's automated, most of the time). Things get better, all the time. |
Right; that matches my understanding. So, maybe to rephrase my intent—couldn't we, then, update the Octane integration such that it would only enable worker mode if the application is running in production? |
I assume they accept PRs, so I assume it would be possible. |
Describe you feature request
We'd like to use FrankenPHP for our Laravel application (running in Docker), but using it with XDebug isn't as straight-forward as the website claims it is:
MAX_REQUESTS=1
in the environment, a breakpoint triggered and then removed will be triggered again on a subsequent request, and only on the third request will it no longer be triggered.In combination, that makes debugging hard to use, which has encouraged some of our developers to go back to
dd()
—ugh!Hence, I would kindly like to ask for two thinks:
We're using PHP 8.3, Xdebug 3.3.2, Laravel 11 with current Octane, and the latest FrankenPHP Docker image (as a base image for our own).
The text was updated successfully, but these errors were encountered: