2012-02-13 65 views

回答

53

夫妇更多的事情要考虑:

php app/console cache:clear --env=prod --no-debug 
php app/console assets:install web_directory 
php app/console assetic:dump web_directory 

您也可能遇到缓存目录的权限问题。在切换到生产模式之前,我实际上首先要确保服务器上的所有工作都处于开发模式。如果你在生产模式下得到的只是空白屏幕,那么将debug设置为true。当然知道如何检查错误日志。

+1

你能告诉我在哪里检查错误日志吗? – Noor 2012-02-14 07:17:09

+0

Symfony日志在app/logs中。 Web服务器依赖于服务器以及它如何配置,因此无法真正帮助那里。 – Cerad 2012-02-14 14:15:49

+0

你回答是答案,顺便说一下,所有那些将使用这个答案的人,每次你改变脚本中的某些内容,执行此操作,php应用/控制台缓存:clear --env = prod --no-debug ,也有时你需要更改权限,所以做一个chown! – Noor 2012-02-15 17:05:09

11

部署一个确定指导移动Symfony2的生产是指:通过

访问的应用程序:app.php/

测试开发包将不会被加载,因为当您使用app.php时,AppKernel.php中存在一个条件。如果你想卸载捆绑只应在开发中使用,你可以将它们放置到本节(在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(); 
     } 

您还需要通过désactivating了XDebug和增加eacclerator(做一些服务器调整或其他成才缓存性能)

我还建议重新命名app_dev.php到disactivate开发模式

+1

你可以更加明确地说明如何设置生产模式 – Noor 2012-02-14 07:34:07

-5

在您的 “网络/ app.php” 文件

$kernel = new AppKernel('prod', false); 

将值更改为 “true”。

$kernel = new AppKernel('prod', true); 

现在可以在生产模式下加载应用程序。

+0

这是一个非常糟糕的做法,根本与部署应用程序无关。 – 2015-08-15 07:18:00

相关问题