1

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: [email protected]
    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?

3
  • Most likely your web server is failing to pass the request to symfony. Perhaps there is an alternate log location in its config or its logging is turned off. The best way to hunt this down is to get the web server itself to log to a location you can access and find out what's going on. Commented Nov 25, 2015 at 17:35
  • It was an internal Symfony2 thing and now everything works. Commented Nov 25, 2015 at 17:42
  • Have you checked your php logs? Also you might be able to check the logs for your webserver (for example if using nginx the error_log defined in your configuration for your symfony app). I would also check your php.ini and see if display_errors is set to on. If you still have problems you can put the code listed here inside your app_dev.php at the top. In the end it might just be write permissions so you can check if your app/logs folder is writable by www-data Commented Nov 25, 2015 at 21:35

1 Answer 1

0

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 );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.