Monthly Archives: August 2013

AngularJS with Symphony2


AngularJS is great. I personally think it is an upgrade from jQuery.

I have been testing AngularJS with Symfony2. One of the problems to build a web application with these two frameworks is that Symfony2’s twig language uses the same symbol operator.

For example: PHP uses , AngularJS uses {{ }}, and Symfony2’s twig uses {{ }} as well.

The solution is to change the default AngularJS symbol to something else.

After your page finish loading the AngularJS, in your script, add the following function:

angular.module(‘apps’, [])
.config([‘$interpolateProvider’, function ($interpolateProvider) {

It change the symbol operator from using {{ }} to using [[ ]]. 

Remember, you also need to define your app in your html code inside the . In this case, I define the AngularJS app to use apps, therefore, in my , I need to define it using

Have fun coding!

Symfony2 and Amazon EC2


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.