Need Help a Warning

imrocker

New Member
Messages
5
Reaction score
0
Points
0
Warning: Cannot modify header information - headers already sent by (output started at /home/imrocker/public_html/index.php:1) in /home/imrocker/public_html/index.php on line 2

im new in this hosting in the another host all my web are nice... nothing bad
but when i upload again all mypage i see that error i hope what you can help me

you can see the error here
http://www.imrocker.es/
i really dont know never happend it to me :(
:dunno: i try to fix the errors but say me a syntasyx error :S


need ur help :(
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
What's on and around line 2? Chances are that you are either trying to set a cookie or use header(); _after_ text has already been sent to the browser (thus headers already sent).

It could be as simple as just relocating the problem to the top of the script or using ob to capture any text that would otherwise be output and then set the contents to a variable and then show it after anything dealing with the headers have finished.
 

gomarc

Member
Messages
516
Reaction score
18
Points
18
Yes, as xPlozion said, that message means that something was sent to the browser before your line 2. The headers must be sent before anything else is sent to the browser.

Maybe we can help if you post your first 2 lines of code.
 

imrocker

New Member
Messages
5
Reaction score
0
Points
0
PHP:
<?
header("Cache-Control: no-store, no-cache, must-revalidate");
include('includes/config.php'); 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="es" xmlns="http://www.w3.org/1999/xhtml" lang="es">
<head>
<title><?=$title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
    <style type="text/css">
<!--
.Estilo1 {color: #666666}
.Estilo2 {color: #FF6600}
.style1 {font-weight: bold}
.Estilo4 {
 font-size: xx-small;
 color: #FFFFFF;
}
.Estilo6 {font-size: xx-small; color: #000000; }
.Estilo9 {font-size: xx-small; color: #14181B; }
-->
    </style>
<script type="text/javascript" src="<?=$root ;?>/js/ajax.js"></script>
<script type="text/javascript" src="<?=$root ;?>/js/jquery-min.js"></script>
<script type="text/javascript" src="<?=$root ;?>/js/swfobject.js"></script>
</head><body>
  <div id="mp3">
    <div id="cnenav"><strong>ImRocker!!™ Webpages Systems</strong>    <span class="Estilo6">Musica Gratis Musica Online</span></div> 
 
    <div id="global-header">
      <div class="logobar">
        <a href="http://www.<?=$site ;?>/" title="<?=$site ;?>" class="logo"><span><?=$site ;?></span></a>
        <div class="user"></div>
 
      </div>
  <div class="search">
    <div class="rubics_netxp1_main" id="rbx_netxp1_parent">
 <span class="xpromositename"></span>
 <img src="<?=$root ;?>/css/fab.gif" alt="Agregar a favoritos" width="13" height="11"> <a href="javascript:window.external.AddFavorite('http://www.<?=$site ;?>','<?=$site ;?> - <?=$slogan ;?>');" class="xpromolink">Agregar a favoritos</a> | 
 <img src="<?=$root ;?>/css/cs.gif" alt="Usar como página de inicio" width="13" height="11"> <a href="http://www.<?=$site ;?>/" onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.<?=$site ;?>');return false" class="xpromolink">Usar como página de inicio</a>
</div>
<form action="buscador.php" method="get" onsubmit="javascript:return valida(this);">
                  <tr>
                    <td style="padding:5px; font-weight:normal; text-decoration:none; font-size:10px" align="center">
                      <input value="<?=$q;?>" size="40" name="q" />
                      <input type="submit" value="Buscar" />
                        <label><span class="Estilo2">
                        <input type="radio" name="j" value="1" />
                        </span></label>
                        <span class="Estilo2"> Cantante&nbsp;
                        <label>
                        <input type="radio" name="j" value="2"  />
                        </label>
Canci&oacute;n&nbsp;
<label>
<input type="radio" name="j" value="3" checked="checked" />
</label>
Todo </span><br />
                      <label></label></td>
                  </tr>
      </form>
      </div>
 
        <div class="nav">
        </div>
    </div>
    <div id="global-subnav">               
  <ul>
    <li><a href="#" class="signup">Artistas por letra:</a></li><li><a href="<?=$root ;?>/Letra,a">A</a></li><li><a href="<?=$root ;?>/Letra,b">B</a></li><li><a href="<?=$root ;?>/Letra,c">C</a></li><li><a href="<?=$root ;?>/Letra,d">D</a></li><li><a href="<?=$root ;?>/Letra,e">E</a></li><li><a href="<?=$root ;?>/Letra,f">F</a></li><li><a href="<?=$root ;?>/Letra,g">G</a></li><li><a href="<?=$root ;?>/Letra,h">H</a></li><li><a href="<?=$root ;?>/Letra,i">I</a></li><li><a href="<?=$root ;?>/Letra,j">J</a></li><li><a href="<?=$root ;?>/Letra,k">K</a></li><li><a href="<?=$root ;?>/Letra,l">L</a></li><li><a href="<?=$root ;?>/Letra,m">M</a></li><li><a href="<?=$root ;?>/Letra,n">N</a></li>
 
 <li><a href="<?=$root ;?>/Letra,o">O</a></li><li><a href="<?=$root ;?>/Letra,p">P</a></li>
 
 <li><a href="<?=$root ;?>/Letra,q">Q</a></li><li><a href="<?=$root ;?>/Letra,r">R</a></li><li><a href="<?=$root ;?>/Letra,s">S</a></li><li><a href="<?=$root ;?>/Letra,t">T</a></li><li><a href="<?=$root ;?>/Letra,u">U</a></li><li><a href="<?=$root ;?>/Letra,v">V</a></li><li><a href="<?=$root ;?>/Letra,w">W</a></li><li><a href="<?=$root ;?>/Letra,x">X</a></li><li><a href="<?=$root ;?>/Letra,y">Y</a></li><li><a href="<?=$root ;?>/Letra,z">Z</a></li><li><a href="<?=$root ;?>/Letra,0">0-9</a></li>
  </ul>
    </div>
         <div id="superleader">
    </div>
    <div id="mp3-content">
<div id="mpu-layout">
    <div id="main-col">
this is the code php a little part of my index of a music webpage well i erase the line what call the includes/header.php
and all is equal! say me it again... and no one page call the header :S

i think what is a error whit this ?
<?
header
("Cache-Control: no-store, no-cache, must-revalidate"
);
include(
'includes/config.php'
);
?>

but the config.php call the data base :S i dont know! u say what a part of the page call the header after... but not now... :S
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
I think I found the problem :)

change all of these:
Code:
<?

to this:
Code:
<?php
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
Short tags could be the problem, but only if the server doesn't support them. But then again, if they weren't enabled, then the PHP wouldn't execute.

Is there any real purpose for the Cache-Control? You mentioned something about a header.php file. Seeing as how English isn't your native tongue, I couldn't make out your message clearly. Was the header.php file on line 2 or if not, then what line was it on?
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
250
Points
63
I think it would have to be the short tags because the headers are sent on line 1.
 

xPlozion

New Member
Messages
868
Reaction score
1
Points
0
And make sure to check that you don't have any spaces on the first line where the PHP tag is, as that will cause the error iirc ;)

But try replacing <? with <?php . There's several reasons to do so: <? is also short-hand for XML, <? is being removed or disabled in future PHP versions 6.* iirc, and it's just plain lazy and frowned upon by the PHP community.
 

imrocker

New Member
Messages
5
Reaction score
0
Points
0
well thanks for ur help i have fix the error
this is the cause

<?
header("Cache-Control: no-store, no-cache, must-revalidate");
include('includes/config.php');
?>

and letter

include('header.php')

have erase this part
header("Cache-Control: no-store, no-cache, must-revalidate");


beasue of it the page sent 2 times the header

:-I

well i dont know why the server tell me it if in my other hosting
all work fine!


...

now i have another problem my web is for mp3 online
and my player dont call the music for my SQL db :S
i dont know why...

after fixing the error the player work fine..
and now not!

thanks all for your help
 
Top