Symfony2 and Amazon EC2

Categories: General


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:

  1. ssh into the Linux box. 
  2. run apt-get install php
  3. add yourself into the www-data group
  4. change the /var/www owner and group to www-data (chown www-data:www-data /var/www)
  5. change the permission of /var/www to 775 (chmod 775 /var/www)
In the /var/www directory
  1. curl -sS | php
  2. 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])
  3. go to the web directory under the folder s (/var/www/s)
  4. change the app/logs and app/cache owner to www-data
  5. edit these files and comment out the redirection
(It is because you didn't set it up on the localhost, it is on the AWS EC2)

Now, you should able to see your server running symphony 2. 

Next | Previous