Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-settings.php on line 530

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 611

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/controlz/public_html/blog/wp-includes/classes.php on line 728

Strict Standards: Redefining already defined constructor for class wpdb in /home/controlz/public_html/blog/wp-includes/wp-db.php on line 306

Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-includes/cache.php on line 103

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/controlz/public_html/blog/wp-includes/cache.php on line 425

Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/controlz/public_html/blog/wp-includes/theme.php on line 623

Strict Standards: Redefining already defined constructor for class WP_Dependencies in /home/controlz/public_html/blog/wp-includes/class.wp-dependencies.php on line 15

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/controlz/public_html/blog/wp-settings.php:472) in /home/controlz/public_html/blog/wp-content/plugins/si-captcha-for-wordpress/si-captcha.php on line 31

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/controlz/public_html/blog/wp-settings.php:472) in /home/controlz/public_html/blog/wp-content/plugins/si-captcha-for-wordpress/si-captcha.php on line 31

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in /home/controlz/public_html/blog/wp-includes/plugin.php on line 311
Warning Sessio Cache Limiter | formatic.cat

Entradas con la etiqueta ‘Warning Sessio cache limiter’

session_start(): Warning Sessio cache limiter - headers alredy sent

Viernes, 13 de Febrero de 2009

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/controlz/public_html/blog/wp-content/plugins/ig_syntax_hilite/geshi.php on line 2056

Como todos sabemos la instrucción que crea las sessiones:

session_start();

debe de estar al principio de todo de fichero para evitar problemas.  Esta función puede estar mas abajo siempre que tengamos claro que no hemos usado ninguna otra función de php o html que saque texto o qualquier cosa a la salida del navegador.

Pero que pasa cuando en la primera linea del fichero sin nada mas por encima que el tag de abrir php <? ó <?php

Se nos queja de que las cabeceras ya han sido enviadas, sin que nostros hayamos echo ningún "echo", ni print_r o print o nada por el estilo?

Que está ocurriendo cuando se queja que hemos enviado ya algún caracter y no lo vemos? Entonces se nos queja algo al estilo así:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/xxxx/public_html/miproyecto/index.php:1) in /home/xxxx/public_html/miproyecto/index.php on line 2

Como puede ser que en la línea 1 o linea 2, ya hayamos enviado algun dato al navegador?

la cuestion es muy sencilla hay caracteres que no somos capaces de ver y que el editor que usamos para editar los fichoros no nos muestra y lo peor no lo podemos borrar con suprimir, ni bakspace. Por algún motivo, ese fichero tiene al principio algun caracter no representable que nos está fastidiando.

si abrimos el fichero con algun otro editor llegaremos a ver algo al estilo:  ï¿½ï¿½ 

La solución es crear un nuevo fichero y copiar el codigo en este nuevo fichero y al subierlo. todo funcionará conrrectamente.

Otro problema al usar includes, que seguir la pista de si hemos echo algun eco es mas dificil. Puesto que en proyectos grandes, puedemos tener vairos ficheros unos incluyendose a otros, etc.

Así si el problema no es de nuestro fichero sino de algun include. podemos arreglar el fallo usando buffers de salida.

en la primer linea ponemos nuestro ob_strat(); quien incia el buffer y toda salida a pantalla quedara atapada en el hasta que hagamos dos cosas:

  • $variable=ob_get_contents() ; //->nos pone el contenido del buffer en una variable por si queremos usarlo
  • ob_end_clean(); //-> elimina todo el buffer, y el posible caracter ilegal que nos esta fastidiand
  • ob_end_flush(); //-> saca el contenido del buffer al navegador.
evidentemente en nuestro caso usariamos el segundo.
El ejemplo quedaría algo asi:
PHP:
  1. ob_start(); // inciamos el buffer
  2. include('primerFichero.php');
  3. include('segundoFichero.php');
  4. include('segundoFichero.php');
  5. ob_end_clean(); // borra textos de debug u otras salidas que no interesarian
  6. //inicio de session

espero que os sirva de ayuda.