1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

"Warning: Cannot modify header information - headers already sent by" Error Help

Discussion in 'PHP' started by valandil, Apr 5, 2008.

  1. #1
    That's the error I get when I go to my website. I checked all the usual solution like blank spaces and using output buffer all to no avail.

    The exact line is

    Warning: Cannot modify header information - headers already sent by (output started at /home/valandil/public_html/domination.php:1) in /home/valandil/public_html/sta/topper.php on line 342
    Code (markup):
    The first line of domination.php is and that's before the <HTML> tag.

    <?php $id=2; include("/home/valandil/public_html/sta/topper.php");?>
    Code (markup):
    Since line 342 is the error, I''ll post line 330 to 346 of topper.php

    $spath=$_SERVER['SERVER_NAME'];
    	if (substr($_SERVER['SERVER_NAME'], 0,4) == "www.")
    	{
    		$spath = substr($_SERVER['SERVER_NAME'], 4);
    	}
    	$string = serialize($visitor_array);
    	if($iscomplexserver)
    	{
    		setcookie("vacookie",$string,time()+3600*24*365,"/");
    	}
    	else
    	{
    		setcookie("vacookie",$string,time()+3600*24*365,"/", $spath);
    	}
    
    
    }
    
    Code (markup):
    Anyone can help me? I searched google, I searched this forum and nothing.

    Thanks a lot.
     
    valandil, Apr 5, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Did the script send information to the browser with echo or a space or something. Cookies can only be set when there is no content send to the browser
     
    EricBruggema, Apr 5, 2008 IP
  3. valandil

    valandil Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I don't know. How can I find out if the script send any information or not? I'm really new to this.
     
    valandil, Apr 5, 2008 IP
  4. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #4
    Is the script started after some HTML code? or starts the HTML before the script is started?
     
    EricBruggema, Apr 5, 2008 IP
  5. valandil

    valandil Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'll try to explain as best as I could. Domination.php is my webpage and I'm asked to insert that first line into it by the readme file. topper.php comes from the developer and shouldn't be edited.

    The script you are talking about... is it topper.php? If so, then no. It doesn't appear to contain any HTML... all php codes.
     
    valandil, Apr 5, 2008 IP
  6. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #6
    Is the a space before the first <? in your document? or some HTML codes?

    Can you give more detaild info (script) like the page you are loading and giving the error (first 4 lines will be fine)
     
    EricBruggema, Apr 5, 2008 IP
  7. valandil

    valandil Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The first 4 lines of domination.php is

    <?php $id=2; include("/home/valandil/public_html/sta/topper.php");?>
    <html>
    <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
    Code (markup):
    while the first 4 lines of topper.php is

    <?php
    //----------------------- Windows Server Snippet -------------------
    	foreach ($_GET as $var => $value)
    	{
    Code (markup):
    There is no space whatsoever before <?.

    And just in case you need the website, it's salescopyquickfix.com/domination.php

    Thanks for the help by the way.
     
    valandil, Apr 5, 2008 IP
  8. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #8
    That's realy weird my friend... coz the error states that the is some send data to the browser..

    Did you write the script your selve? for more help please PM i cannot keep track of all topics ;)
     
    EricBruggema, Apr 6, 2008 IP
    valandil likes this.
  9. PowerExtreme

    PowerExtreme Banned

    Messages:
    2,118
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Do one thing

    add

    ob_start();
    Code (markup):
    after

    <?php 
    Code (markup):
     
    PowerExtreme, Apr 6, 2008 IP
  10. valandil

    valandil Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Hey powerextreme, ya I tried that but it doesn't work. Thanks for the suggestion though.
     
    valandil, Apr 6, 2008 IP
  11. PowerExtreme

    PowerExtreme Banned

    Messages:
    2,118
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    0
    #11
    post the code here...so i can check it
     
    PowerExtreme, Apr 6, 2008 IP
  12. valandil

    valandil Peon

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Hi powerextreme, I already posted the code in my first post. you can go to domination.php at salescopyquickfix.com/domination.php
     
    valandil, Apr 6, 2008 IP