When you start with symfony you probably use the Symfony Standard Edition.
This is a quite good start but there are somethings that helped me and might help you aswell.
Since every beginning is “schwer” :)
So here there are.
1. replace web/app*.dev with the following index.php
its much nicer to use the DirectoryIndex in your URL and not having the web_app.php, thats the aesthetics.
But it also avoids having some hassle with ajax urls which are defined absolute in some scripts like
The Environment can be changed in the .env.php file which just returns the Environment value:
<?php return $env = 'dev';
Personally i dont mind changing the Env in the code rather than in the url, while in development.
It might be a tick more far away but its rather uncommon anyway and it would be more effort to change the vhost DirectoryIndex on web_dev.php and prod everytime to get a clean url.
(thanks max & joshi)
2. resolve console and webserver user conflict for cache
Different to Symfony 1.x Symfony2 assumes a more sophisticated User Managment on your machine for Security reasons, which absolutly makes sense. Read more about it here:http://symfony.com/doc/current/book/installation.html#configuration-and-setup
This means you have to adjust the rights for the webserver- and for the console user that both can create and delete the cache.
This requires some admin skills which might be a bit too much for starters.
And some people start wondering why the
php app/console cache:clear
command wont work and start using
rm -rf app/cache/*
To fix this Symfony2 recommends as a ‘hotfix’ to uncomment the
part on top of your bootstrap files.
So simply uncomment the line in app_dev.php ( if you use the one from above its already done :) ) and in app/console.
Thats alright for local setup, for production go and talk to your admin of trust or live the life of adventure.
3. make a local config that can be placed in gitignore
Here you can store config parameters and overwrite common ones to fit your local setup. Put it in the gitignore so your fellow devs can do the same.
Therefor we need to hack the AppKernel.php and redefine the registerContainerConfiguration method like so.
Now have fun with bundles & services.