注册FOSUserBundle时出现白屏


White screen during registration with FOSUserBundle

在/register中发送表单后,我在同一页面中出现白屏。

我不知道如何调试这个,任何帮助不胜感激。

这是 prod.log 文件(我将其action_level配置为"调试"):

[2012-08-14 05:32:20] request.INFO: Matched route "fos_user_registration_register" (parameters: "_controller": "Symfony'Bundle'FrameworkBundle'Controller'RedirectController::urlRedirectAction", "path": "/register/", "permanent": "true", "scheme": "null", "httpPort": "80", "httpsPort": "443", "_route": "fos_user_registration_register") [] []
[2012-08-14 05:32:20] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2012-08-14 05:32:20] security.DEBUG: Write SecurityContext in the session [] []
[2012-08-14 05:32:20] request.INFO: Matched route "fos_user_registration_register" (parameters: "_controller": "FOS'UserBundle'Controller'RegistrationController::registerAction", "_route": "fos_user_registration_register") [] []
[2012-08-14 05:32:20] security.INFO: Populated SecurityContext with an anonymous Token [] []
[2012-08-14 05:32:20] security.DEBUG: Write SecurityContext in the session [] []
[2012-08-14 05:32:38] request.INFO: Matched route "fos_user_registration_register" (parameters: "_controller": "FOS'UserBundle'Controller'RegistrationController::registerAction", "_route": "fos_user_registration_register") [] []
[2012-08-14 05:32:38] security.INFO: Populated SecurityContext with an anonymous Token [] []

检查 var/log/apache2/error 中的 apache 错误日志.log

某处可能存在PHP错误。请查看您的 Apache error_log文件(大多数情况下它位于 /var/log/apache 中)。

如果您没有 Apache,请在 php 中更改以下 PHP 设置.ini:

display_errors Off
log_errors On
error_log=/var/log/php_errors.log
显然,

在生产模式下,Nginx,PHP和Symfony2不会记录一些错误。

我的解决方案是克隆站点并在app.php中将其更改为 true:

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

所以现在我有两个"生产"实例,一个为真,另一个为假。

错误是这样的:

Fatal error: Class 'Mongo' not found in /some/doctrine/file

你应该阅读 http://symfony.com/doc/current/bundles/DoctrineMongoDBBundle/index.html

我确定您忘记将DoctrineMongoDBBundle添加到应用程序/AppKernel中的捆绑包中.php

// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Symfony'Bundle'DoctrineMongoDBBundle'DoctrineMongoDBBundle(),
    );
    // ...
}

还要检查供应商目录中的相应文件