Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP header error

Options
  • 22-06-2006 12:57pm
    #1
    Registered Users Posts: 673 ✭✭✭


    Hey,

    I have done a few basic php websites directly on a live hosting server and have recently started a new project but this time i am running it on a local testing server. For this new project i have reused some code from my old site.

    I am getting the following error [PHP]Warning: Cannot modify header information - headers already sent by (output started at d:\website\washtec\washtec_website\database.php:15) in d:\website\washtec\washtec_scripts\transact_user.php on line 26[/PHP] but i do not get this error on the older site which is directly on the live server.

    Could this meanthat the error reporting is set up differently on the live server and this is why i dont see this same error on the old site? Is this error critical or could this same problem be on the old site but i just never realized because the error never showed?


Comments

  • Registered Users Posts: 6,440 ✭✭✭jhegarty



    I am getting the following error [PHP]Warning: Cannot modify header information - headers already sent by (output started at d:\website\washtec\washtec_website\database.php:15) in d:\website\washtec\washtec_scripts\transact_user.php on line 26[/PHP] but i do not get this error on the older site which is directly on the live server.


    looks like you are trying to send the http header twice... whats on that line of code ?


  • Registered Users Posts: 673 ✭✭✭Bananna man


    When someone logs in they are redirected to another page on the site. The code is [PHP] header("Location: ".include_once $_SERVER.'/washtec_website/database.php'); [/PHP]


  • Registered Users Posts: 6,440 ✭✭✭jhegarty


    When someone logs in they are redirected to another page on the site. The code is [PHP] header("Location: ".include_once $_SERVER.'/washtec_website/database.php'); [/PHP]


    looks like you are trying to send a second header... you browser already have received one and won't accept a second one...

    for a simple solution just print a meta-refresh instead.....


  • Closed Accounts Posts: 169 ✭✭akari no ryu


    It's possible that you've written to the page before setting the header's reload option.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Is there also a chance that you have an include() that writes this header?


  • Advertisement
  • Registered Users Posts: 6,414 ✭✭✭kdouglas


    that error is generally caused when data is output before that header() call, check to make sure there is nothing that generates output before it, and also check that there are no spaces before the <?php tag as this can be a cause of this problem also.


  • Registered Users Posts: 6,508 ✭✭✭daymobrew


    jhegarty wrote:
    for a simple solution just print a meta-refresh instead.....
    No, don't do this - it results in unnecessary trips to the server.

    Bananna man, can you do a 'wget --debug' on the problem URL? It might show you the headers being returned.
    Another thing to try is to print use the included script in a normal page to ensure it is returning the expected value i.e.
    [PHP]<?php echo include_once $_SERVER.'/washtec_website/database.php'; ?>[/PHP] or something like that.


Advertisement