Foro de elhacker.net

Programación => Desarrollo Web => Mensaje iniciado por: [u]nsigned en 16 Junio 2015, 22:26 pm



Título: Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Publicado por: [u]nsigned en 16 Junio 2015, 22:26 pm
Hola! Les cuento que tengo un servidor casero montado en ubuntu 12.04. Le instale un stack LAMP desde los repositorios. Por defecto no me muestra ningun tipo de error, no me deja suar la funcion error_reporting. Asi que busque un poco y modifique todos mis archivos php.ini

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

Y quedaorn asi (http://pastebin.com/LT8yie8h)

Luego reinicie apache:
sudo service apache2 restart

Pero sin ver ningun error de php  :huh:


Título: Re: Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Publicado por: MinusFour en 16 Junio 2015, 23:27 pm
En la sección:

Código:
; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = Off

display_errors lo tienes que poner a On.

Tambien puedes hacer:

Código
  1. ini_set('display_errors', '1');

El php.ini que se usa es el que esta en /etc/php5/apache2


Título: Re: Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Publicado por: [u]nsigned en 17 Junio 2015, 02:01 am
Citar
display_errors = On
;   Default Value: On
;   Development Value: On
;   Production Value: Off

display_startup_errors = On
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

error_reporting = E_ALL
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED

Lo tengo asi, reinicie apache pero nada, sigo sin ver errores, simplemente arroja una pagina en blanco cuando hay un error en php.


Título: Re: Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Publicado por: MinusFour en 17 Junio 2015, 04:35 am
Lo tengo asi, reinicie apache pero nada, sigo sin ver errores, simplemente arroja una pagina en blanco cuando hay un error en php.

Esa no es la sección que puse. De hecho, esa sección que has puesto me desconcertó un poco, no esta en mi php.ini pero si revisas el header:

Citar
;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.

En otras palabras, esa sección entera es de referencia y creo que te has confundido descomentado esas lineas. Las settings estan mas adelante, usa el bloque que he pegado para referencia.


Título: Re: Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Publicado por: [u]nsigned en 21 Junio 2015, 17:49 pm
Esa fue la sección quie edite, especificamente esta:
Código:
;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.

; allow_call_time_pass_reference
;   Default Value: On
;   Development Value: Off
;   Production Value: Off

display_errors = On
;   Default Value: On
;   Development Value: On
;   Production Value: Off

display_startup_errors = On
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

error_reporting = E_ALL
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED

De la linea 86 a la 112.

Podrias pasarme un copia de tu php.ini para ponerlo tal cual? Usas Ubuntu 12.04?

Muchas gracias!!!

Alguien tiene alguna sugerencia o algo? ya probé todo lo que encontre en Google y nada, sigo sin ver errores en mi LAMP xD


Título: Re: Habilitar error_reporting en Apache2 (Ubuntu 12.04)
Publicado por: MinusFour en 21 Junio 2015, 18:54 pm
Mi php.ini es de arch y yo tengo apagado los errores. Si ves mi primer post:

En la sección:

Código:
; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
;   Off = Do not display any errors
;   stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
;   On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors = Off

Esta sección que te pase, la copie directamente de tu php.ini que pusiste al inicio, como puedes ver al final del bloque dice:

Código:
display_errors = Off

Esta es la sección que tenias que haber modificado.