-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add PHP (Embed SAPI) #70
Labels
Comments
@cubiclesoft Since this seems nuanced, and I am not familiar with embedding PHP, could you PR an entry for PHP with a good "notes" column? (Do not edit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't see
PHP
orPHP (Embed SAPI)
in the list. PH7 seems to be listed but is basically a dead project.It's a little known fact that a PHP SAPI ("Server" API) can be compiled specifically for embedding full PHP scripting engine support into other C/C++ software applications:
--enable-embed[=static]
at compile time generates theembed
SAPI. From there, just include the appropriate header files and link against the library during compilation. For non-C/C++ languages, the language will probably need a C shim that adds a small translation layer. PHP is VERY macro-heavy, which means trying to correctly import shared library exports is not a really great idea.Since embedding support is already included with the PHP language itself, I guess just link to www.php.net?
https://www.phpinternalsbook.com/php7/build_system/building_php.html
The macro
PHP_EMBED_START_BLOCK
seems to be the magic Google/GitHub/StackOverflow search engine keyword that turns up sample working code snippets. For example, I got this:https://stackoverflow.com/questions/73345686/store-output-of-php-execute-script
The text was updated successfully, but these errors were encountered: