-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[WIP] an approach to embedding main() into sapi/embed from php code #19707
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
Conversation
dbe7470
to
ab744a1
Compare
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.
if this is yes/empty we could use basename of PHP_EMBED_MAIN
, this will normally be correct.
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.
I'm not exactly sure why this is here, it doesn't look correct ... I moved to register_server_variables
because that's idiomatic, and allows consumers to control this behavior appropriately
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.
lifted from cli, possibly this should be exported API function in main
...
henderkes
commented
Sep 7, 2025
This is essentially the same as compiling embed=static followed by compiling and linking a simple C program that executes php code against the produced libphp.a, right?
https://github.com/easysoft/phpmicro goes for a different approach to provide the same functionality.
Uh oh!
There was an error while loading. Please reload this page.
This is a possible approach to deploying embed with some php code embedded for
main()
, we don't have to require any special deps, or really make significant changes.Options:
--with-embed-main
takes path to php/phar file--with-embed-link
takes path for symlink creation (phar requires a symlink with the same name as the archive when it was created)Possible improvements:
Tested widely enough to make sure phar archives work, obvious this is very nix focused, I've no idea how to do this in a windows friendly way.
Example:
--with-embed-main=/path/to/pie.phar --with-embed-link=pie.phar
creates: