Let`s start to learn symfony2!

Lesson1 – How to install symfony2.4 in only 4 steps?

Composer

Step1. We need to install composer. What is composer ? Composer is a dependency manager for PHP. Just like PEAR for PHP. Or just like npm for node.js. Or Bundler for Ruby. Or apt-get for Ubuntu. You can read more about composer here.

Download composer to your computer :

 curl -s http://getcomposer.org/installer | php

 

Step2. Optional, but recommended. Move composer.phar file into your bin for use it in all projects :

 sudo mv composer.phar /usr/local/bin/composer

 

Sometimes you need to run sudo composer self-update to update composer to latest version (Composer will tell you when, no worries)

 

Step3. Get the symfony2 code!

 composer create-project symfony/framework-standard-edition /var/www/path_to_sf_project

(This will may take 2-3 minutes)

 Symfony2 will ask you to complete the database and mailer settings (just in the image bellow).

 

Step4. Set the right file permissions.

4.0 Go to project path :

 cd /var/www/path_to_sf_project

 

4.1 Change the ownership of cache/logs directories (them will be owned by www-data group) :

 sudo chown -R :www-data app/cache app/logs

 

4.2 This ensures that new files and directories are automatically owned by the same group as their parent.

 sudo chmod g+s app/cache app/logs

 

 

That’s all. Now we have a full symfony2 application. Easy, not ? You can access it on http://localhost/path_to_sf_project/web/app_dev.php

sf_demo

Leave a Comment

Your email address will not be published.

Scroll to Top