PHP is one of the most popular backend programming language use in 2012 (#5) and it will stay at the same rank in 2013. The strength of PHP is its simplicity and integration with HTML. Once you know the basic logic design, you can build a backend supported website pretty quickly. However, the simplicity of PHP also became one of its weakness. It is difficult to manage for big application. Luckily, there are many frameworks available today to solve this problem.
In this article, I want to introduce one of the PHP framework that is popular among PHP developers, the Symphony 2, and how to set it up on Amazon EC2.
Once you get into the AWS EC2 management console, launch a Spot Instance with at least m1.medium. It is because I will be using composer to set up the Symphony.
After you launch the instance (ubuntu Linux) on AWS:
- ssh into the Linux box.
- run apt-get install php
- add yourself into the www-data group
- change the /var/www owner and group to www-data (chown www-data:www-data /var/www)
- change the permission of /var/www to 775 (chmod 775 /var/www)
- curl -sS https://getcomposer.org/installer | php
- php composer.phar create-project symfony/framework-standard-edition s/ 2.3.1
(it will download the symfony version 2.3.1 to the directory [/var/www/s])
- go to the web directory under the folder s (/var/www/s)
- change the app/logs and app/cache owner to www-data
- edit these files and comment out the redirection
Now, you should able to see your server running symphony 2.