Symfony 2: 404 Not Found Error when tryes to open /app_dev.php

Miloš picture Miloš · Sep 14, 2012 · Viewed 18.1k times · Source

I am getting this error message when try to open

/app_dev.php

An error occurred while loading the web debug toolbar (404: Not Found).

Do you want to open the profiler?

When I click ok, I am getting then the error:

app_dev.php/_profiler/5053258a822e1

and

404 Not found

I am using nginx

Thank you very much for your help.

EDIT: Here is the error log:

[error] 18369#0: *9 open() "/var/www/Symfony/web/app_dev.php/_wdt/5056f875afc98" failed (20: Not a directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app_dev.php"
[error] 18369#0: *9 open() "/var/www/Symfony/web/404" failed (2: No such file or directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app_dev.php"

EDIT 2:

When i try to access app_dev.php the page opens but without the toolbar and when I try with app_dev.php/ I am getting the

**Oops! An Error Occurred
The server returned a "404 Not Found".
Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused. **

error.

Answer

Mohammad AbuShady picture Mohammad AbuShady · Mar 8, 2013

I know this isn't exactly what you asked but might help future people who search for this issue, like @yvoyer suggested, my issue was the trailing slash too, my server used nginx and fpm, and in nginx // does not euqal /, so i had to do a bit of fixes on my virtual host conf and it worked fine after that. I'll just paste the conf for whoever needs it, or suggests a better one.

    location / {
            try_files $uri @pass_to_symfony;
    }

    location ~ /app_dev.php/ {
            try_files $uri @pass_to_symfony_dev;
    }

    location @pass_to_symfony{
            rewrite ^ /app.php?$request_uri last;
    }

    location @pass_to_symfony_dev{
            rewrite ^ /app_dev.php?$request_uri last;
    }

    location ~ ^/app(_dev)?\.php($|/) {
            include fastcgi_params;
            fastcgi_pass   unix:/var/run/php5-fpm.sock; # replace with your sock path
    }