Compiling PHP
The build pipeline lives in a Dockerfile. It was originally forked from seanmorris/php-wasm
In broad strokes, that Dockerfile:
- Installs all the necessary linux packages (like
build-essential) - Downloads PHP and the required libraries, e.g.
sqlite3. - Applies a few patches.
- Compiles everything using Emscripten, a drop-in replacement for the C compiler.
- Compiles
php_wasm.c– a convenient API for JavaScript. - Outputs a
php.wasmfile and one or more JavaScript loaders, depending on the configuration. - Transforms the Emscripten's default
php.jsoutput into an ESM module with additional features.
To find out more about each step, refer directly to the Dockerfile.