Skip to content

Instantly share code, notes, and snippets.

@makasim
Created September 2, 2011 10:40
Show Gist options
  • Save makasim/1188358 to your computer and use it in GitHub Desktop.
Save makasim/1188358 to your computer and use it in GitHub Desktop.
how to easy setup dev env for sf project
/etc/apache2/httpd.conf
<Macro sf $host $dir>
<VirtualHost $host.dev:80>
DocumentRoot /home/maksim/projects/$dir
<Directory />
Order Allow,Deny
Allow from All
</Directory>
SetEnv APPLICATION_ENV dev
</VirtualHost>
<VirtualHost $host.test:80>
DocumentRoot /home/maksim/projects/$dir
<Directory />
Order Allow,Deny
Allow from All
</Directory>
SetEnv APPLICATION_ENV test
</VirtualHost>
</Macro>
Use sf YOUR_PRJ_HOST YOUR_PRJ_RELATIV_DIR
index.php
<?php
$env = getenv('APPLICATION_ENV') ?: 'dev';
$debug = getenv('APPLICATION_DEBUG') ?: $env !== 'prod';
require_once __DIR__.'/../application/autoload.php';
require_once __DIR__.'/../application/AppKernel.php';
use Symfony\Component\HttpFoundation\Request;
$kernel = new AppKernel($env, $debug);
$kernel->loadClassCache();
$kernel->handle(Request::createFromGlobals())->send();
now you have YOUR_PRJ_HOST.test and YOUR_PRJ_HOST.dev urls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment