Search code examples
symfony1http-status-code-404

Symfony : I get a 500 instead of a 404


I've created custom 404 error pages for my symfony application, but they don't seem to work. In dev I see :

This request has been forwarded to a 404 error page by the action "blabla".

But in prod, the page is just blank; I get a 500 error.

In the logs, the error is :

PHP Parse error:  syntax error, unexpected T_PUBLIC in /var/www/myproject/apps/myapp/modules/default/actions/actions.class.php on line 7

default/actions/actions.class.php is the following :

<?php
/**
 * Error page for page not found (404) error
 *
 */

public function executeError404()
{

}

public function executeSecure()
{

}
?>

I followed this tutorial on symfony-check.org


Solution

  • I found the answer all by myself :D I'd forgotten part of the file :

    class defaultActions extends sfActions
    {
        public function executeError404() {}
    }