Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

"Session already sent" problem

adeydasadeydas Posts: 43Member
Hi,

I have two pages from a larger script called med.php and client.php. The user is sent to med.php from where he is automatically redirected to client.php after doing a few things. However, when it goes to client.php it gives the following errors:

[code]Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:wwwssecexamclientmed.php:1) in C:wwwssecexamclientmed.php on line 72

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:wwwssecexamclientmed.php:1) in C:wwwssecexamclientmed.php on line 72

Warning: Cannot modify header information - headers already sent by (output started at C:wwwssecexamclientmed.php:1) in C:wwwssecexamclientmed.php on line 75[/code]

The code for the pages are here:

med.php: http://adeydas.com/dump/med.phps
client.php: http://adeydas.com/dump/client.phps

Any help will be highly appreciated.

Thanks,
Abhishek.


Abhishek
http://adeydas.com

Comments

  • rencesalmingorencesalmingo Posts: 1Member
    : Hi,
    :
    : I have two pages from a larger script called med.php and client.php.
    : The user is sent to med.php from where he is automatically
    : redirected to client.php after doing a few things. However, when it
    : goes to client.php it gives the following errors:
    :
    : [code]: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:wwwssecexamclientmed.php:1) in C:wwwssecexamclientmed.php on line 72
    :
    : Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:wwwssecexamclientmed.php:1) in C:wwwssecexamclientmed.php on line 72
    :
    : Warning: Cannot modify header information - headers already sent by (output started at C:wwwssecexamclientmed.php:1) in C:wwwssecexamclientmed.php on line 75[/code]:
    :
    : The code for the pages are here:
    :
    : med.php: http://adeydas.com/dump/med.phps
    : client.php: http://adeydas.com/dump/client.phps
    :
    : Any help will be highly appreciated.
    :
    : Thanks,
    : Abhishek.
    :
    :
    : Abhishek
    : http://adeydas.com


    Hi,

    Problems like these often occur when "some" html had been sent to the browser BEFORE headers are prepared (like baking cookies and serving them, or tinkering with session variables).

    You can check your code if indeed some html had been sent:

    example:
    ---------------------------------------------------

    <?php

    A blank line on top of the opening PHP tag at the top of the file actually sends a HTML code - a blank space get rid of that and see if it works


    if that does not work, try using output buffering before anything else happens in the code :
    =====================================================================
    <?php
    ob_start();


    and at the end:

    ob_end_flush();
    ?>
    ======================================================================

    see what works ...



Sign In or Register to comment.