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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP header error

  • 22-06-2006 11:57am
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 6,441 ✭✭✭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, Registered Users 2 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, Registered Users 2 Posts: 6,441 ✭✭✭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, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


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


  • Advertisement
  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 6,570 ✭✭✭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