Middleware in PHP: Compiling It With elephc, Then Not Needing To
Fitting PHP into ePHPm's native middleware ABI with an ahead-of-time compiler, and what that experiment said about where PHP middleware should actually run.
ePHPm middleware runs before PHP. It’s a small versioned C ABI, loaded with
dlopen, that gets to look at a request and reject it before PHP boots or the request body is read. That’s the
right shape for a gateway. It’s the wrong shape for most PHP shops, who want to write their middleware in PHP. This is
the story of compiling PHP into a native .so to fit that ABI and finding exactly where it broke. Then I built the lane
that should have existed in the first place.
