2012-09-14 104 views
13

estoy recibiendo este mensaje de error cuando intenta abrirSymfony 2: 404 Not Found error cuando tryes para abrir /app_dev.php

/app_dev.php

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

Do you want to open the profiler? 

Al hacer clic en OK, estoy recibiendo entonces el error:

app_dev.php/_profiler/5053258a822e1 

y

404 Not found 

Estoy usando nginx

Muchas gracias por su ayuda.

EDIT: Aquí está el registro de errores:

[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:

Cuando intento acceder a la página se abre app_dev.php pero sin la barra de herramientas y cuando trato con app_dev.php/Obtengo el

**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.

+1

¿Puedes publicar tu registro de error de nginx? (No solo lo que está impreso en su navegador!) – Florent

+0

Gracias Florent, he cambiado mi pregunta –

+0

Resuelto, verifique mi respuesta aquí: http://stackoverflow.com/a/30313196/1700429 – Dahab

Respuesta

10

sé que esto no es exactamente lo que usted pidió, pero puede ayudar a las personas que realizan búsquedas futuras para este problema, como sugirió @yvoyer, mi problema era la barra al final también, mi servidor usaba nginx y fpm, y en nginx // no es euqal /, así que tuve que hacer algunas correcciones en mi configuración de host virtual y funcionó bien después de eso. Solo pegaré la conf para quien la necesite, o sugiero una mejor.

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 
    } 
0

Para mostrar la barra de herramientas de depuración web en modo desarrollador en la página Symfony2 debe tener un código HTML válido.

+0

Gracias @Rafal, pero estoy tratando de abrir el archivo app_dev.php, viene del Sitio web de Symfony. ¿Cómo resolver este problema? –

-1

He encontrado la solución (más o menos). Tomé otro proyecto Symfony existente y todo funciona bien ahora. Realmente no sé por qué la versión estándar de Symfony no funciona en mi caso ... Si alguien necesita el proyecto de Symfony vacío, puedo subir el archivo.

EDIT: aquí es la plantilla del Symfony 2.0 trabajo: http://www.megafileupload.com/en/file/372986/Symfony-tpl-zip.html

+0

cargue el archivo, tengo el mismo problema – tesmojones

+2

Aquí está la plantilla de Symfony. Disfruta: http://www.megafileupload.com/en/file/372986/Symfony-tpl-zip.html Si encuentras esto útil, por favor devuélvete. Gracias. –

3

que tenía el mismo error, pero me di cuenta de que el mensaje era de salida cuando he escrito app_dev.php/ pero no al solicitar app_dev.php (Nótese la barra final /).

Creo que tiene que ver con el router, pero simplemente es una conjetura

-3

por favor intente prestar atención a su .htaccess, tuve este problema también y arreglé el mío.

<IfModule mod_rewrite.c> 
    RewriteEngine On 
     RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$ 
    RewriteRule ^(.*) - [E=BASE:%1] 
    RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
    RewriteRule ^app_dev.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L] ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially 
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteRule .? - [L] 
    RewriteRule .? %{ENV:BASE}/app_dev.php [L]  ##### this is the part that you should tweak, have the .htaccess point the request to app_dev.php, since the routing.yml is empty initially 
    </IfModule> 

    <IfModule !mod_rewrite.c> 
    <IfModule mod_alias.c> 
     # When mod_rewrite is not available, we instruct a temporary redirect of 
     # the startpage to the front controller explicitly so that the website 
     # and the generated links can still be used. 
     RedirectMatch 302 ^/$ /app.php/ 
     # RedirectTemp cannot be used instead 
    </IfModule> 
    </IfModule> 
+5

Lea la publicación completa en primer lugar: "Estoy usando nginx Muchas gracias por su ayuda." Si bien tu comentario es apropiado para APACHE, atormentará a la gente. – Zjoia

-1

Sucedió en mi Environnement dev, así que comentar la directiva DirectoryIndex en mi archivo de configuración de host virtual, por lo que ahora tengo a mi aplicación con: http://127.0.0.1/app_dev.php Y no hay más errores sobre el generador de perfiles! Uso Symfony 2.3.x.

0

Mi error estaba relacionado con la configuración de Nginx (usando Symfony 3.1), y que acaba de editar la configuración recomendada para Nginx de Symfony:

http://symfony.com/doc/current/setup/web_server_configuration.html

Por lo tanto, tal vez fue debido a los enlaces simbólicos, no sé.

he copiado una pequeña parte de Nginx config y editado para que coincida con todos los .php:

## 
# You should look at the following URL's in order to grasp a solid understanding 
# of Nginx configuration files in order to fully unleash the power of Nginx. 
# http://wiki.nginx.org/Pitfalls 
# http://wiki.nginx.org/QuickStart 
# http://wiki.nginx.org/Configuration 
# 
# Generally, you will want to move this file somewhere, and start with a clean 
# file but keep this around for reference. Or just disable in sites-enabled. 
# 
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. 
## 

# Default server configuration 
# 
server { 
    listen 80 default_server; 
    listen [::]:80 default_server; 

    # SSL configuration 
    # 
    # listen 443 ssl default_server; 
    # listen [::]:443 ssl default_server; 
    # 
    # Note: You should disable gzip for SSL traffic. 
    # See: https://bugs.debian.org/773332 
    # 
    # Read up on ssl_ciphers to ensure a secure configuration. 
    # See: https://bugs.debian.org/765782 
    # 
    # Self signed certs generated by the ssl-cert package 
    # Don't use them in a production server! 
    # 
    # include snippets/snakeoil.conf; 

    root /var/www/html; 

    # Add index.php to the list if you are using PHP 
    index index.html index.htm index.nginx-debian.html; 

    server_name _; 

    location/{ 
     # First attempt to serve request as file, then 
     # as directory, then fall back to displaying a 404. 
     try_files $uri $uri/ =404; 
    } 


    # Symfony 
    location ~ \.php(/|$) { 
      fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; 
     fastcgi_split_path_info ^(.+\.php)(/.*)$; 
     include fastcgi_params; 
     # When you are using symlinks to link the document root to the 
     # current version of your application, you should pass the real 
     # application path instead of the path to the symlink to PHP 
     # FPM. 
     # Otherwise, PHP's OPcache may not properly detect changes to 
     # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 
     # for more information). 
     fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; 
     fastcgi_param DOCUMENT_ROOT $realpath_root; 
    } 


    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
    # 
    #location ~ \.php$ { 
    # include snippets/fastcgi-php.conf; 
    # 
    # # With php7.0-cgi alone: 
    # fastcgi_pass 127.0.0.1:9000; 
    # # With php7.0-fpm: 
    # fastcgi_pass unix:/run/php/php7.0-fpm.sock; 
    #} 

    # deny access to .htaccess files, if Apache's document root 
    # concurs with nginx's one 
    # 
    #location ~ /\.ht { 
    # deny all; 
    #} 

} 


# Virtual Host configuration for example.com 
# 
# You can move that to a different file under sites-available/ and symlink that 
# to sites-enabled/ to enable it. 
# 
#server { 
# listen 80; 
# listen [::]:80; 
# 
# server_name example.com; 
# 
# root /var/www/example.com; 
# index index.html; 
# 
# location/{ 
#  try_files $uri $uri/ =404; 
# } 
#} 

Yo recomendaría que se pega a la recomendación de Symfony para un servidor de producción.

Cuestiones relacionadas