15 Nov Can You Run a Serverless PHP Site on Amazon Web Services?
Most would assume that it is not possible to run a PHP website on Amazon Web Services Lambda. But a programming expert has proven that to be incorrect. Mathieu Napoli has come up with a package that ensures a serverless PHP site is able to run on this platform. But how does it work?
Packaging Code for AWS Lambda
There is an entire process involved in packaging code for the serverless PHP site and ensuring that it is compatible with AWS Lambda. The beauty of this process is that you can end up with a site that functions, while also offering fully functional web services.
Creating a Simple Site
The example shown is for a very simple website, which is dedicated to a book launch. The site is very basic, where readers can check out information related to the book. They are also able to enter their email address on the site, which is how they get access to bonus materials.
If the user has an email service that is linked to AWS Lambda, they are able to take care of the email newsletters through that avenue. All that needs to happen is tweaking the front end to allow people to sign up for the list where they receive said emails.
Tweaking the Site
In order to get this done, a simple email form was needed. And the form must have a POST route inside it so that it can link to the email service the site owner is using. One option is to use the Slim framework as it is such a simple process. But it would be possible to use other PHP frameworks, such as Laravel and Symfony.
There are online guides that will help you navigate the rest of the process. Numerous steps must be completed, such as installing Bref, creating an application that can respond to HTTP requests, and then deploying the application.
Self Creating Websites
Being able to combine the effectiveness of PHP frameworks with the accessibility of AWS Lambda is incredibly important. Not only does it show developers what is possible, but it also means the average person can go ahead and create a site that would be useful to their circumstances.
Not every venture requires a professionally created site. For a simple task, such as providing information about a book and including the option to sign up to an email list, setting up a serverless PHP site on AWS Lambda fits the bill perfectly.