-
-
Notifications
You must be signed in to change notification settings - Fork 251
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
feat: add CLI support #239
Conversation
ebf1585
to
293f57f
Compare
This command is now good enough to run Composer and scripts built with Symfony Console! |
os.Exit(status) | ||
|
||
return status, nil |
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.
Hmm. This return will never be reached. I think returning will let Caddy call os.Exit
anyway, so I don't think you need to do that yourself.
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.
This doesn't work (the returned status code is always 1
in case of error, even if set explicitly in PHP with exit
).
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.
🤔 then that's possibly a bug in Caddy. Good to know.
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.
Opened caddyserver/caddy#5874 to fix that. The status code wasn't being carried through since we enabled Cobra
if len(args) < 1 { | ||
return 1, errors.New("the path to the PHP script is required") | ||
} |
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.
Makes me think, is there value in making php-cli -i
work for example? (Could be useful to check enabled features). Some people use php -a
and php -l
on occasion too. But 🤷♂️
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 think it would be great if ./frankenphp php <args>
behaved identical to php <args>
with php-cli installed.
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.
That would be nice, but it's a bit more work. The best option would be to allow the embedding of the official PHP SAPI (this requires a patch on PHP). I suggest merging this patch as is and trying to improve it later.
Co-authored-by: Francis Lavoie <[email protected]>
This patch allows FrankenPHP to execute CLI scripts. This is especially useful when using the static binary to run Composer, Symfony or Laravel commands.
Continuation of #4.