Lesson1 – How to install symfony2.4 in only 4 steps?
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 :
1 |
curl -s http://getcomposer.org/installer | php |
Step2. Optional, but recommended. Move composer.phar file into your bin for use it in all projects :
1 |
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!
1 |
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 :
1 |
cd /var/www/path_to_sf_project |
4.1 Change the ownership of cache/logs directories (them will be owned by www-data group) :
1 |
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.
1 |
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