Home » PHP » Página blanca de la muerte en WordPress

Página blanca de la muerte en WordPress

Una de las razones de la aparición de la temida página blanca de la muerte en WordPress puede estar provocada por un hecho que califico como "la traición del editor de texto". 

Muchas veces modificamos algunos detalles mínimos en el archivo wp-config.php o ini.php y como el cambio es tan simple que utilizamos directamente el editor que nos ofrece Filezilla y al guardar el archivo el editor, sin avisarnos, le cambia el formato de "UTF-8 sin BOM" a formato "UTF-8 con BOM".

¿Qué es el BOM?

El BOM (byte order mark) es un caràcter Unicode – (en 16 bits, U+FEFF; en 8 bits, 0xEF,0xBB,0xBF); este byte tiene la utilidad de  Indicar el orden del byte, o endianness, del stream de texto y la codificación Unicode utilizada.   

Cuando se usa BOM, ya que es opcional, debería aparecer al inicio del flujo de texto.  

El problema de la pantalla blanca

Detrás de este error suele estar el fallo "Headers already sent". 

Puede ser que simplemente se nos haya colado un espacio antes de <?php y esto producirá el error; pero otras veces las razones son otras: muchas veces el archivo "con BOM" engaña al PHP y hace creer que ya se han enviado datos al header. Veamos el log de errores de PHP:

30-May-2015 14:03:39 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/load.php on line 136
[30-May-2015 14:03:39 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/load.php on line 137
[30-May-2015 14:04:20 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/pluggable.php on line 1178
[30-May-2015 14:04:20 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/load.php on line 136
[30-May-2015 14:04:20 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/load.php on line 137
[30-May-2015 14:04:20 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/load.php on line 136
[30-May-2015 14:04:20 UTC] PHP Warning:  Cannot modify header information – headers already sent by (output started at /home/prestige/public_html/wp-config.php:1) in /home/prestige/public_html/wp-includes/load.php on line 137

 

Cuando en realidad, nuestro código PHP no había cometido ningún pecado!!!

Solución: Guardar sin BOM

La solución es abrir el archivo php "culpable" (en este ejemplo, el log indica que es wp-config.php) y simplemente guardarlo sin BOM (UTF-8 sin BOM). Esto lo podemos hacer con el Notepad++:

Guardar sin BOM

Deja una respuesta

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.