473,408 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Warning: session_start(): Cannot send session cookie - headers already sent by

Bob
Seem to have a problem ending a session. I get the following message.
Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
C:\xitami\xitami-24\app\webpages\logout.php:9) in
C:\xitami\xitami-24\app\webpages\logout.php on line 10

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
C:\xitami\xitami-24\app\webpages\logout.php:9) in
C:\xitami\xitami-24\app\webpages\logout.php on line 10

You have been logged off, you must re-login to use the system.
Log In

The code is as follows.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Logged Out</title>
</head>

<body>
<?php
session_start();
session_unset();
session_destroy();

//unset($HTTP_SESSION_VARS['valid_user']);
//unset($HTTP_SESSION_VARS['privlevel']);
//session_destroy();

echo '<h3>You have been logged off, you must re-login to use the
system.</h3>';
echo '<a href="log_in.php">Log In</a><br />';
?>

</body>
</html>
I am using Homesite4.5 and saving the file as "pc" format. The
webserver is Xitami.

Help would be appreciated.
Jul 17 '05 #1
4 14060
>Seem to have a problem ending a session. I get the following message.

Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
You may not output ANYTHING before calling session_start(), (or
other functions that need to send headers, like cookie setting).
Nada. Zip. Nothing. Put your HTML, DOCTYPE, blank lines, single
spaces, etc. *after* calling session_start().

Gordon L. Burditt
C:\xitami\xitami-24\app\webpages\logout.php:9) in
C:\xitami\xitami-24\app\webpages\logout.php on line 10

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
C:\xitami\xitami-24\app\webpages\logout.php:9) in
C:\xitami\xitami-24\app\webpages\logout.php on line 10

You have been logged off, you must re-login to use the system.
Log In

The code is as follows.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Logged Out</title>
</head>

<body>
<?php
session_start();
session_unset();
session_destroy();

//unset($HTTP_SESSION_VARS['valid_user']);
//unset($HTTP_SESSION_VARS['privlevel']);
//session_destroy();

echo '<h3>You have been logged off, you must re-login to use the
system.</h3>';
echo '<a href="log_in.php">Log In</a><br />';
?>

</body>
</html>
I am using Homesite4.5 and saving the file as "pc" format. The
webserver is Xitami.

Help would be appreciated.

Jul 17 '05 #2
While the city slept, Bob (cl****@qualitythink.com) feverishly typed...
Seem to have a problem ending a session. I get the following message.

Warning: session_start(): Cannot send session cookie - headers already

[etc]

You cannot have any output before the session (including normal HTML
output). Try re-organising as follows;

<?php
session_start();
session_unset();
session_destroy();

//unset($HTTP_SESSION_VARS['valid_user']);
//unset($HTTP_SESSION_VARS['privlevel']);
//session_destroy();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Logged Out</title>
</head>

<body>
<h3>You have been logged off, you must re-login to use the system.</h3>';
<p><a href="log_in.php">Log In</a></p>
</body>
</html>

.... A couple of non-php points. It is probably time for you to consider
coding the HTML 4.01 Strict doctype. Why have you used H3 to mark up the
"You have been logged off..." text? Where are the first and second level
headings that should precede it?

Hope that helps,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #3
Bob
Thanks to both of you for the help.
Jul 17 '05 #4
While the city slept, Bob (cl****@qualitythink.com) feverishly typed...
Thanks to both of you for the help.


Your welcome. :-)

Cheers,
Nige

--
Nigel Moss
http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phyzlo | last post by:
Hello, I've recently started learning PHP and have a question. I tried running below script which can be found at http://se2.php.net/manual/sv/function.setcookie.php but I keep getting this...
1
by: None | last post by:
Hello, I am a total newbie to PHP and programming in general. I am playing around with a PHP / MySQL shopping cart script which I found at...
2
by: bobkaku | last post by:
I added session control to my survey application. I want to retain the person's name entered on the 1st page and use it as a variable value on subsequent pages. I added on the first script: ...
3
by: lawrence k | last post by:
I'm getting this warning: PHP Warning: session_start(): Cannot send session cache limiter - headers already sent in...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
2
by: samcode3 | last post by:
Hi, I would be thankfull if anyone could give me the solution for this header problem. There are no blank spaces at end as there is html code in end. I have used <?php session_start();?> in first...
5
by: siyaverma | last post by:
Hi, I am new to php, i was doing some small chnages in a project developed by my collegue who left the job and i got the responsibility for that, After doing some changes when i run it on my...
3
by: mrosado | last post by:
Hi everybody, I have this problem.- The browser launch this two errors: Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at...
2
by: sanjusb | last post by:
My problem is : Warning: session_start() : Cannot send session cookie - headers already sent by (output started at /home/xtreme/public_html/forum_tire.php:2) in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.