-
Notifications
You must be signed in to change notification settings - Fork 297
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
[2.x] Add support for FrankenPHP #764
Conversation
Very cool - will review! 🙏 |
Very cool @dunglas! |
The description about the https isn't clear, feels like HTTP3 is enabled when https is on but HTTP2 is always on. |
@vasilvestre thanks! To clarify: by default, only HTTP/1.1 (unencrypted) is enabled. When |
Co-authored-by: William Desportes <williamdes@wdes.fr>
super, i will try it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hey everyone! @dunglas and I spoke a bunch about FrankenPHP in the past; I'm a Caddy maintainer by night, and a PHP dev by day, so these comments come from that perspective.
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
c860fb5
to
6c47901
Compare
Co-authored-by: Kennedy Tedesco <kennedyt.tw@gmail.com>
Co-authored-by: Kennedy Tedesco <kennedyt.tw@gmail.com>
Co-authored-by: Kennedy Tedesco <kennedyt.tw@gmail.com>
Hey @dunglas. We're currently running Octane/Swoole + Nginx. If we were to switch Nginx with Caddy (so Swoole + Caddy), how would that be different from FrankenPHP? The proxy configuration is already extremely simple in Caddy, and the Caddy process itself is lightweight, so what are the practical benefits of this complex integration? I'm not discrediting your work, just am curious of whether we should switch and how this can be beneficial to us. Thanks :) |
Hi @oprypkhantc, the main difference is that with FrankenPHP, Caddy isn't acting as a proxy: FrankenPHP is a custom build of Caddy with an extra module that embeds PHP in it. That means that PHP and Caddy are the same program, running as the same process. Calling the PHP engine from Caddy is just a function call, with no network connection involved, no IPC, etc. It's probably explained more clearly at the beginning of this video: https://www.youtube.com/watch?v=q6FQaaFZVy4 |
Thank you. It'd be interesting to see if this affects performance for our API-only app though, as there's not a lot of traffic, so likely not a lot of overhead from the proxying. I'll post the results when I get to try it if anyone is interested. |
Thanks, cool video! |
@fannyfan414 see https://caddyserver.com/docs/automatic-https#storage, you're meant to configure storage to be shared across all your instances. You can use filesystem syncing, or you can use a Redis storage module, for example. |
Very interested in this. How does this effect running it as a binary with octane? |
Waiting for this... |
Second this - anyone know of any guides on how to build a binary with octane yet? |
Sorry for the noob question, when using
|
@ARehmanMahi this will use the PHP engine embedded in the binary. This should work, even with no local installation of PHP. |
@dunglas Thanks for the reply, one more question as I'm a bit unclear. As FrankenPHP has its own PHP, I assume P.S. If that's the case, I can completely get rid of systems php for the project I reckon. Which feels great. |
@ARehmanMahi if you alias Otherwise, your system won't know which binary to run when you type Also, keep in mind that composer will try to resolve the PHP binary, so you still need a globally accessible PHP binary, be it an alias to the FrankenPHP binary or a system installed one. |
Is this still in beta version like in the Octane Docs until now? |
I'm wondering the same, and whether there is somewhere that we can track progress of this integration moving out of beta. We are holding off moving to octane until this integration stabilises as it seems to be the most promising in a number of ways. |
Speaking from experience, you'll likely have to fix countless little bugs when moving to Octane, regardless of what specific web server you'll be using, be it RoadRunner, Swoole or FrankenPHP. Octane itself is stable as far as I know and as far as I've seen in the last year we've been running it in production. Switching the integration from Swoole to FrankenPHP should not touch any of your application code and should require only minimal changes to your (hopefully containerized) setup, so consider moving to Octane/Swoole first and only then to FrankenPHP :) |
@oprypkhantc your 1st & 2nd line seems contradictory. Is it moving to Octane that will cause countless bugs? Moving to in-memory application architecture requires a keen eye on using STATIC/Singleton, which could cause bugs or memory leaks. Note to self. |
@ARehmanMahi Moving to Octane itself is likely to cause bugs. And the problem is not just static/singletons; we had more problems with Laravel itself than with our app code. There is a lot that Octane does to "fix" the poor implementation choices of Laravel; for example, the container/app instance is cloned for every request, meaning you have to be extra careful when injecting the |
Okay, so you mean it's not necessarily the app or octane, but laravel itself. |
This patch adds FrankenPHP as a runtime for Laravel Octane!
To get started, use the following commands:
The current implementation provides feature parity with RoadRunner (worker mode, watch, and max requests) but also adds new features not supported by the other engines:
--https
flag is passed)mvanduijker/laravel-mercure-broadcaster
for seamless integration with Laravel Broadcast.