Home » Php » php – How can I deploy my zend framework 2 application to AWS elastic beanstalk?

php – How can I deploy my zend framework 2 application to AWS elastic beanstalk?

Posted by: admin July 12, 2020 Leave a comment


I understand how to do a basic deployment on AWS elastic beanstalk, but one of the things I’m trying to figure out is how to deploy a Zend Framework 2 application. Because Zend Framework 2 apps depend on Apache running with mod_rewrite, how can I configure my elastic beanstalk to also ensure that Apache is executing with mod_rewrite?

Edit: I’m going to add to this question. I’m not even sure mod_rewrite is an issue anymore. I simply can’t even deploy the zend framework 2 skeleton app on elastic beanstalk. I have no problem deploying a single simple PHP file, but deploying an actual zend framework 2 app is a no go. Any ideas?

How to&Answers:

Okay this was solved with some help in the #zftalk IRC. I was never successful in uploading using the AWS beanstalk web interface, so instead I used the AWS eb tool and the AWSDevTools.

The best bet is to go into the root of your project. I followed the linux instructions here:

Then moved on to the deploy instructions here:

This still didn’t work. So, I went to the web interface of my environment on elastic beanstalk and had to edit the configuration so that the document root in the container pointed to /public. Following this, the server was returning a 500, so I looked in the logs and saw it was having problems with the framework itself. On my local copy I made sure composer had installed everything, I removed the git ignore files from vendor and then committed the project. I pushed out the project with git aws.push again and this worked.