Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13

Thread: Headers Output

  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Headers Output

    <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /home/fantasy3/public_html/rose/theproject/config.php:19) in <b>/home/fantasy3/public_html/rose/theproject/secure.php</b> on line <b>9</b><br />

    header('Location: login.php'); is line 9. It won't let me use the header function.

    line 19 of config is just the end of the file. Any help?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,468
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    Does your config.php have this at the beginning and end?

    <?php


    ?>

  • #3
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts
    yea it does...shoudln't it?

  • #4
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Yes it should. Is there anything after the ?>, including blank lines, spaces, etc?

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,468
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    darn ... I thought that would be it.

    How is config.php called?

    Is there something in another script that has "require" or "require-once"
    to include that script? I'm trying to imagine why it thinks there are
    duplicate headers.

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    You're outputting something around line 19 in the config.php file.

  • #7
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts
    They were blank spaces. I call like 3 files, one is the HTML headers like meta codes and stuff. Should headers be before that?

  • #8
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You cannot have ANY form of output before a header() call. Not a space, not an echo, not a cookie, not a session.

  • #9
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,024
    Thanks
    2
    Thanked 314 Times in 306 Posts
    Actually, a cookie and a session use headers, so they can be used.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #10
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you could session_start() and then use a header() call under that?

  • #11
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,024
    Thanks
    2
    Thanked 314 Times in 306 Posts
    Yes, give it a try.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #12
    New Coder
    Join Date
    Aug 2007
    Location
    Wagga, Australia
    Posts
    59
    Thanks
    0
    Thanked 1 Time in 1 Post
    yes you can, how else would you be able to log someone on with out starting a session?

    but yes ole90 it sounds like you have added another header()
    just try and comment out anything that isn't to vital and see the results.

  • #13
    New Coder
    Join Date
    Aug 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CFMaBiSmAd - I didn't know that, I had some code I put together not too long ago, which handled sessions, but then lower in my code I was doing some image conversion using GD, which required a header() call, and it kept bombing, strange.

    Thanks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •