The latest service offering from Amazon Web Services is AWS Elastic Beanstalk, allowing companies to deploy applications to Amazon’s cloud and let Amazon handle deployment and scaling of infrastructure automatically.
From Amazon:
You simply upload your application, and Elastic Beanstalk automatically handles the deployment details of capacity provisioning, load balancing, auto-scaling, and application health monitoring.
While Amazon claims they’re working on other platforms, initially Beanstalk only supports Java applications deployed in the Apache Tomcat 6 container. However…using Quercus, a “100% Java implementation of PHP 5” from Caucho, we can run PHP using AWS Elastic Beanstalk. All it takes is setting up a simple Maven project.
The first step is to setup the Caucho Maven repository and our dependencies in our POM:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
For this demo, I used the web.xml and PHP files from Caucho’s Quercus download and added a phpinfo.php page to show phpinfo() output. Here’s what our Maven webapp directory structure looks like:

Running mvn package produces a war file that can be deployed to AWS Elastic Beanstalk without any further modifications. After waiting a few minutes for the EC2 instance to start up, here’s our phpinfo.php file running on AWS:

That’s it…we have PHP running on AWS Elastic Beanstalk. It could not have been easier. Chances are Amazon will add PHP support down the road but until then you can run your own PHP applications using Quercus.
The full project code can be downloaded on GitHub at https://github.com/clstokes/aws-elastic-beanstalk-php.