-
-
Notifications
You must be signed in to change notification settings - Fork 117
feat: embed PHP thanks to FrankenPHP #216
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
base: main
Are you sure you want to change the base?
Conversation
@@ -31,6 +31,7 @@ import ( | |||
"path/filepath" | |||
"syscall" | |||
|
|||
"github.com/dunglas/frankenphp" |
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.
Does it make sense to have here a go build tag? Frankenphp uses a lot of cgo which would break the release ci pipeline as it's not possible to cross compile anymore 🤔
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.
We could do that, but first I'll try to have to build a release pipeline supporting all current targets (they are supported by PHP, and we can use Docker to cross-compile).
That's a great initiative, but would it support the |
@Kocal not yet. FrankenPHP is only compatible with PHP 8.2+. |
How much will that increase the size of the Symfony binary? Why does one tool have to solve all issues? |
As we still need to have a local PHP setup for the CLI (a Symfony project requires a PHP CLI, at least to run composer), is there any benefit for that ? This only saves installing the |
I would say about 100mb (rough estimate)
I agree. Also we lose the multi version support and we don't expose the configurability of Franken so no big win here I think. |
Maybe we can do something by working wi Go plugins to have this optional? |
@stof, FrankenPHP now natively supports CLI scripts too. The Caddy plugin already has this feature, this should be easy to add to Symfony CLI. |
Also, FrankenPHP supports libphp.so in addition to static builds, so it should be possible to distribute (or , better, download on demand) different PHP versions, for instance from the PHP Builder project (also used by setup-php), which provides dynamic libphp builds compatible with FrankenPHP. This approach would also have the benefit of not increasing much the binary size. |
Thanks to FrankenPHP, it's possible to embed PHP directly in the Symfony Local Web Server.
That's what this patch does!
symfony server:start --frankenphp
Basically, that means that you don't need a local installation of PHP anymore.
The code is working, but the build chain isn't ready. We'll have to build
libphp
in the CI and statically link the produced binary against it.Support for other PHP SAPI is still included and FrankenPHP is currently opt-in.
Current limitations are:
Needs symfony-cli/phpstore#3