This project is a WIP php runtime environment
The Stackery php runtime is tailored to API Gateway, while I wanted a more "traditional" Lambda runtime. ie, load a file, execute a function.
Further, I wanted a runtime which provided minimal pollution of the global php environment when executing. We define no global functions, and we depend on no composer packages. This reduces the runtime's chance of conflicting with a given function's dependencies or application code.
The binaries must be compiled on Amazon Linux 2017.03 - which is the environment Lambda runs in. We use docker for this purpose, so you'll need this installed.
Run make all
, and you'll end up with a build/runtime.zip
. You can upload this zip file
as a custom lambda layer, and then select that you are providing a runtime when you create
your lambda function.
You may configure the version built in the Dockerfile.
ENV PHP_VERSION 7.3.0
aws lambda publish-layer-version --layer-name php-runtime --zip-file fileb://build/runtime.zip
The Stackery runtime project provided a great starting point, and sample code for interacting with the AWS Lambda runtime APIs.
A great writeup showing how to get started writing your own runtime, with examples in PHP!