Building a Custom SAPI - How PHP Actually Talks to the Outside World
php-fpm, mod_php and the PHP command line all plug into PHP the same way. Here's how ePHPm does it, and the shortcut that broke WordPress.
If you’ve only ever run PHP behind nginx, you’ve probably never had to think about how echo reaches a socket. When
you embed PHP like ePHPm does, it’s the first thing you have to answer. The answer
is a SAPI. There is very little written about implementing one. Most of what I know came from reading sapi/cli,
sapi/cgi and sapi/embed in php-src. Then I found out which parts I’d misread. This is the write-up I wanted back
in March.
