down123321123 2015-11-25 17:30
浏览 159

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

I am trying to setup Symfony2 into an existing project, so I am setting everything up from scratch. I keep getting "500 Internal Server Error" inside Symfony2. There are no logs inside web server logs and Symfony2 does not even create a log file inside the the logs directory (I set it up as ROOT/var/logs using AppKernel). Here is my configuration:

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

And here is 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');
    }

}

What am I missing here?

  • 写回答

1条回答 默认 最新

  • du9698 2015-11-25 17:42
    关注

    I dug in Symfony2 source code and found that it was catching the exception before I was sending it. So, for debugging purposes, I changed my handling code to:

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

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程