symfony2给出内部服务器错误,没有日志

时间:2015-11-25 17:30:54

标签: php symfony

我正在尝试将Symfony2设置为现有项目,因此我从头开始设置所有内容。我一直得到" 500内部服务器错误"在Symfony2里面。 Web服务器日志中没有日志,Symfony2甚至没有在logs目录中创建日志文件(我使用AppKernel将其设置为ROOT / var / logs)。这是我的配置:

parameters:
    app_locales: en|fr|de|es|cs|nl|ru|uk|ro|pt_BR|pl|it|ja|id|ca
    app.notifications.email_sender: anonymous@example.com
    locale: en
    secret: "MaEKo3wZsCMIz7tR1uBCyIDGhvJU0EbnYgl0YlhognA"

framework:
    ide: sublime

translator:      { fallback: "%locale%" }
secret:          "%secret%"
router:
    resource: "%kernel.root_dir%/config/routes.yml"
    strict_requirements: ~
form:            ~
csrf_protection: ~
validation:      { enable_annotations: true }
templating:
    engines: ['twig']
default_locale:  "%locale%"
trusted_hosts:   ~
trusted_proxies: ~
session:
    handler_id:  ~
fragments:       ~
http_method_override: true

twig:
    debug:            "%kernel.debug%"
    strict_variables: "%kernel.debug%"


# routes.yml

homepage:
    path: /
    defaults:
        _controller: FrameworkBundle:Controller:template
        template:    default/homepage.html.twig

这是AppKernel.php:

class AppKernel extends Kernel {

    public function registerBundles() {
        return [
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle,
            new Symfony\Bundle\SecurityBundle\SecurityBundle,
            new Symfony\Bundle\TwigBundle\TwigBundle,
            new Symfony\Bundle\DebugBundle\DebugBundle,
            new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle
        ];
    }

    public function getCacheDir() {
        return $this->rootDir.'/../var/cache';
    }

    public function getLogDir() {
        return $this->rootDir.'/../var/logs';
    }

    public function registerContainerConfiguration(LoaderInterface $loader) {
        $loader->load(__DIR__.'/config/config.yml');
    }

}

我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

我在Symfony2源代码中挖了一下,发现在发送之前它正在捕获异常。因此,出于调试目的,我将处理代码更改为:

$response = $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false );