LambdaPHP v0.01

Quick and Dirty PHP website hosting (with PHP support) using Aws Lambda (i.e. pay by requests instead of paying a fixed monthly hosting fees).

Remember the good old days when you used to FTP your PHP files, static HTML files, css files to a web server? Now you can do that using AWS Lambda with LambdaPHP!

But why should I care?

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 if you have two files, index.php and deep/other.php inside your public folder, by just typing lambdaphp deploy you can deploy them online at https://yourdomain.com/index.php, https://yourdomain.com/deep/other.php, etc.

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 your are 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

Examples

Limitations

FAQ

Need more features?

Please star this project or comment on hacker news show your interest. This was just a weekend project for my own amusement but I will definitely add more features and examples if there is interest! :)

Thanks