Foros del Web » Programando para Internet » PHP »

Warning: Cannot modify header information - headers already sent by (output started a

Estas en el tema de Warning: Cannot modify header information - headers already sent by (output started a en el foro de PHP en Foros del Web. Hola. Tengo un problema... me manda este error mi servidor... Warning: Cannot modify header information - headers already sent by (output started at... no entiendo ...
  #1 (permalink)  
Antiguo 26/05/2011, 08:53
 
Fecha de Ingreso: abril-2010
Mensajes: 34
Antigüedad: 14 años
Puntos: 1
Exclamación Warning: Cannot modify header information - headers already sent by (output started a

Hola.

Tengo un problema... me manda este error mi servidor... Warning: Cannot modify header information - headers already sent by (output started at... no entiendo porque sucede ya que lo e probado de manera local... en un servidor de un amigo... en un hosting ya levantado... pero en mi VPS me manda este error... ya revise si tenia espacios en blanco en el HTML o en los tags <?php... y nada.. todo esta correcto... porque podria ser este error... pongo el código donde me lo manda...

Código PHP:
Ver original
  1. <html>
  2. <body>
  3. <link rel="shortcut icon" href="benq.ico">
  4. <?php
  5. if(stristr($_SERVER["HTTP_ACCEPT"],"text/vnd.wap.wml")){// Si el Navegador soporta WML
  6. $url = "bb2010/bb.php";
  7. }else{
  8. $url = "index_web.php";
  9. }
  10. header("Location:$url");
  11. ?>
  12. </body>
  13. </html>

me pueden ayudar por fas...
  #2 (permalink)  
Antiguo 26/05/2011, 08:55
Colaborador
 
Fecha de Ingreso: octubre-2009
Ubicación: Tokyo - Japan !
Mensajes: 3.867
Antigüedad: 14 años, 6 meses
Puntos: 334
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

Lee esto http://www.forosdelweb.com/wiki/PHP:...dy_sent%3F
y estohttp://www.forosdelweb.com/wiki/PHP:...n_line_4%22%3F
__________________
More about me...
~ @rhyudek1
~ Github
  #3 (permalink)  
Antiguo 26/05/2011, 09:05
Avatar de scorpion3d  
Fecha de Ingreso: mayo-2011
Mensajes: 92
Antigüedad: 12 años, 10 meses
Puntos: 19
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

Código PHP:
Ver original
  1. <html>
  2. <body>
  3. <link rel="shortcut icon" href="benq.ico">
  4. <?php
  5. if(stristr($_SERVER["HTTP_ACCEPT"],"text/vnd.wap.wml")){
  6. $url = "bb2010/bb.php";
  7. }else{
  8. $url = "index_web.php";
  9. }
  10. header("Location:$url");
  11. ?>
  12. </body>
  13. </html>
__________________
www.elias.com.sv
  #4 (permalink)  
Antiguo 26/05/2011, 09:08
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

scorpion3d, eso no soluciona nada.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #5 (permalink)  
Antiguo 26/05/2011, 09:14
Avatar de scorpion3d  
Fecha de Ingreso: mayo-2011
Mensajes: 92
Antigüedad: 12 años, 10 meses
Puntos: 19
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

A mi si me funca
__________________
www.elias.com.sv
  #6 (permalink)  
Antiguo 26/05/2011, 09:29
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

Cita:
Iniciado por scorpion3d Ver Mensaje
A mi si me funca
Pero es una mala practica, igualmente deberías leer los enlaces que dejo Hidek1, si vamos a ayudar deberíamos hacerlo de la mejor forma.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #7 (permalink)  
Antiguo 26/05/2011, 09:34
Avatar de scorpion3d  
Fecha de Ingreso: mayo-2011
Mensajes: 92
Antigüedad: 12 años, 10 meses
Puntos: 19
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

Vale, vale, ves lo que haces itachi_the_inmortal, por tu culpa me regañaron.
__________________
www.elias.com.sv
  #8 (permalink)  
Antiguo 26/05/2011, 10:12
 
Fecha de Ingreso: abril-2010
Mensajes: 34
Antigüedad: 14 años
Puntos: 1
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

Perdon no fue mi intención...
  #9 (permalink)  
Antiguo 22/12/2011, 09:37
cjd
 
Fecha de Ingreso: marzo-2009
Ubicación: Bs As
Mensajes: 2
Antigüedad: 15 años, 1 mes
Puntos: 0
Respuesta: Warning: Cannot modify header information - headers already sent by (outpu

Amigos... buenos dias

Todo el setup de headers debe hacerse ANTES de cualquier salida, o sea

si tengo

Cita:
<html>
<head>
...
</head>
<body>
...
<?php Locate( seteao un header ); ?>
<body>
deberia dejar

Cita:
<?php Locate( seteao un header ); ?>
<html>
<head>
...
</head>
<body>
...
<body>
ANTES que cualquier otra cosa que forme parte del documento HTML.

Si no sabes que header o que valor de header debes setear antes de formar el documento, entonces es mas complicado, ya que debes apsar por una pantalla donde se configure lo necesario, y en la siguiente (siguiendo lo que ya mencione del orden) se setee el header al inicio.

Saludos

Etiquetas: header, headers, information, modify, output, warning
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:09.