"Session already sent" problem - Programmers Heaven

Howdy, Stranger!

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

Categories

"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.