dbohdan / dbohdan/embedded-scripting-languages
Add PHP (Embed SAPI)
- Dominant language
- No language data
- Stars
- 1.5k
- Forks
- 85
- PR merge metrics
- No merged PRs in 30d
Description
I don't see `PHP` or `PHP (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 the `embed` 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.php.net/)?
https://www.phpinternalsbook.com/php7/build_system/building_php.html
> include/php contains header files, which are needed to build additional extensions _**or embed PHP in custom software.**_
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
Contributor guide
Research direction
Locate the repository's scripting-language list and inspect nearby entries to identify the expected format and link style. Add PHP (Embed SAPI) with the relevant PHP reference link, then verify that the entry matches the surrounding list and renders correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100