I have created this simple three step approach for a Symfony project to switch application contexts while respecting the desire to have a global project-wide config file, vhost and default mod_rewrite configuration.
1. /config.php:
define('URI_ROOT', '/project/web/');
define('MY_ENV', 'dev');
define('MY_DEBUG', true);
$apps = array(
'default' => 'frontend',
'admin' => 'backend'
);
Read More...
Step 1 - Install Symfony into your PHP library path:
# cd /usr/share/php
# wget http://www.symfony-project.org/get/symfony-stable.tgz
# gunzip symfony-stable.tgz ; tar -xvf symfony-stable.tar
# ln -s symfony-X/lib symfony
# mkdir data
# ln -s ../symfony-X/data data/symfony
# rm syfony-stable.tar
Step 2 - Within your Symfony app, edit the main 'settings.yml' file, create a symlink to 'sf' and ensure the cache directory is writable:
$ cd /var/www/localhost/htdocs/sf_app
$ echo "all:" >> config/settings.yml
$ echo " .settings" >> config/settings.yml
$ echo " relative_url_root: /sf_app/web" >> config/settings.yml
$ ln -s /usr/share/php/data/symfony/web/sf .
$ chmod -R 777 cache
And you're done.