Can someone help me to move my Symfony 2 application into production mode?
Currently, the application is running properly in /app_dev.php
.
I'm googling, but I'm not finding a definite guide for deployment in Symfony 2.
Couple more things to consider:
php app/console cache:clear --env=prod --no-debug
php app/console assets:install web_directory
php app/console assetic:dump web_directory
You might also run into permission issues with the cache directory. I would actually first make sure everything works in development mode on the server before switching to production mode. And if all you get is blank screens in production mode then set debug to true. And of course know how to check your error logs.
Moving Symfony2 to production means :
access the application through : app.php/
Test dev bundles won't be loaded since there is a condition into the AppKernel.php when you use app.php. If you want to unload bundle that should be used only in dev, you can place them into the this section (in appKernel.php)
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Sf2gen\Bundle\GeneratorBundle\Sf2genGeneratorBundle();
}
You also need to make some server tuning by désactivating xdebug and adding eacclerator (or someting else for caching performance)
I also advice to rename app_dev.php to disactivate dev mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With