LambdaPHP v0.01

Host your website on Aws Lambda with full PHP 7 support (i.e. pay by requests instead of paying a fixed monthly hosting fee).

Now it's possible for you to host dynamic PHP files, static HTML files, css files on AWS Lambda (serverless) just like an Apache server running mod_php. Any files you put inside the public directory will be accessible as if they were hosted on an Apache server with mod_php. There are no handlers to write or config files to maintain.

For example, put two files, index.php and deep/other.php inside your public folder. The type lambdaphp deploy. Once deployed you should be able to access them online at https://yourdomain.com/index.php, https://yourdomain.com/deep/other.php, etc (details below).

But why should I care?

The Difference is you don't have to pay any monthly hosting fees because they're running on AWS Lambda which means you are billed only by the number of requests. This includes 1 million free requests per month and 400,000 GB-seconds of compute time per month (details here).

Installation

Installation is simple. All you need is PHP 7+ with composer

To install, just type this on your command line (terminal)

composer create-project lambdaphp/lambdaphp <project-name>

This should create a project-name directory inside which there is a public directory. Any files, including any PHP files you put in the public directory can be accessed directly from your web browser.

Once you're done putting files in the public folder, just type this on your command line to deploy your site on AWS Lambda:

lambdaphp deploy -v

You may need to enter your AWS credentials as described here (same as aws-cli).

If everything goes as expected, you should see this message:

Website deployed!
To access your site visit:
https://XXXX.execute-api.us-east-1.amazonaws.com/web/<any-file-in-public-folder><.php|css|js|etc>

(If you get a "command not found" error, make sure you have ./vendor/bin in your PATH)

That's it! LambdaPHP will give you the URL using which you can access your site just like any other site hosted on Apache. It is possible to use your own custom domains with https too (details here).

Features

Using LambdaPHP you can now use AWS Lambda to:

Examples

Limitations

FAQ

Need more features?

This was just a weekend project for my own amusement but I will definitely add more features

Thanks