The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'General Discussion' started by boyforeigner, Dec 8, 2003.

  1. boyforeigner

    boyforeigner Well-Known Member

    Joined:
    May 18, 2003
    Messages:
    46
    Likes Received:
    0
    Trophy Points:
    6
    After transfer a site to a new server it started having the following problem with PHP:

    Warning: Cannot modify header information - headers already sent by (output started at /home/loja/public_html/_param.php:128) in /home/loja/public_html/ljInicio.php on line 54

    Anyone know how to resolve that.
     
  2. cortices

    cortices Well-Known Member

    Joined:
    Mar 10, 2003
    Messages:
    45
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Dallas, TX
    This is actually a programming error, but a common one.

    It means that the script is trying to set a header (ie. setting a cookie, redirection, etc.), but the body output has already been commited. As a header naturally must precede the body, this cannot work and results in an error.

    However, there does exist a workaround for this. In your php.ini you can set the following directive:

    output_buffering On

    Note that this will affect your entire server.

    What this does is cache the output of each PHP request until it is complete, and THEN the entire output is sent to the browser. This allows the programmer to set header information whenever he/she wishes. However, this will result in a severe performance hit on a busy server and a much better solution is to simply fix the script in question.
     
  3. sleuth1

    sleuth1 Well-Known Member

    Joined:
    Mar 16, 2003
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    6
    ?> -----I have spaces here, dont ask why, you just have ! open your php editor on the said page and pull your cursor back to ?> and save, your done. ( this has been true on every occaison I have had this error, if it is not true on this occaison, let me know )
     
Loading...

Share This Page