Right, I’ll keep this brief as there are dozens of Symfony2 tutorials out there. My goal is to utterly distill the process of creating a data-driven Symfony web page, almost to bullet point brevity, using Symfony2 with Doctrine.
Right, I’ll keep this brief as there are dozens of Symfony2 tutorials out there.
My goal is to utterly distill the process of creating a data-driven Symfony web page, almost to bullet point brevity, using Symfony2 with Doctrine.
I’m assuming you know what Symfony2 is and no more. Obviously, you’ll need a LAMP stack, and understanding of apache, and you’ll also need composer (http://getcomposer.org/).
Here we go!
1. Install blank Symfony application in ‘demoapp’ directory (or wherever). You’ll want to check Symfony website for latest version number. Here, we’re installing v2.2.1.
php composer.phar create-project symfony/framework-standard-edition demoapp/ 2.2.1
2. Create the following apache vhost
CustomLog /var/log/apache2/demoapp-access combined
3. Add server name to your hosts file
4. Make sure apache can write to your cache and log files (commands assume we’re in the root of the demoapp directory and apache is running as the www-data user).
sudo chown -R www-data:www-data app/cache
sudo chown -R www-data:www-data app/logs
Note that later on you may have errors if files in these directories have the wrong permissions. You’ll need to update ownership/permissions if that happens.
5. Cool! You should now be able to access the configuration of your demo app.
Go to http://demoapp.local/app_dev.php in your browser.
In part two, we’ll set up the database and configure the application bundle…