473,407 Members | 2,676 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,407 software developers and data experts.

Why can't I use session

Hi,

When I run this script:

<?php
session_start();
$_SESSION['test'] = "Session er smart";
echo $_SESSION['test'];
?>

I get this error-message:

Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
/hotel/svp/WWW/html/php/auth.php:9) in /hotel/svp/WWW/html/php/auth.php on
line 10

Warning: session_start() [function.session-start]: Cannot send session cache
limiter - headers already sent (output started at
/hotel/svp/WWW/html/php/auth.php:9) in /hotel/svp/WWW/html/php/auth.php on
line 10
Session er smart
What is wrong?

Ricki
Jul 17 '05 #1
4 47066
Ricki Susic wrote:
Hi,

When I run this script:

<?php
session_start();
$_SESSION['test'] = "Session er smart";
echo $_SESSION['test'];
?>

I get this error-message:

Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
/hotel/svp/WWW/html/php/auth.php:9) in /hotel/svp/WWW/html/php/auth.php on
line 10

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
/hotel/svp/WWW/html/php/auth.php:9) in /hotel/svp/WWW/html/php/auth.php on
line 10
Session er smart
What is wrong?

As the error says: You are sending things before you do your sessionstuff.
Solution: don't. Put you sessionlogic on top of the page.

Regards,
Erwin Moller
Ricki


Jul 17 '05 #2
With total disregard for any kind of safety measures Erwin Moller
<si******************************************@spam yourself.com>
leapt forth and uttered:
As the error says: You are sending things before you do your
sessionstuff. Solution: don't. Put you sessionlogic on top of
the page.


Actually you just need to make sure you call session_start() before
any output.
--
There is no signature.....
Jul 17 '05 #3
On Mon, 29 Sep 2003 11:52:27 -0500, Phil Roberts wrote:
<snip!>
Actually you just need to make sure you call session_start() before any
output.


Including whitespace!

--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/

Jul 17 '05 #4
Ricki Susic wrote:

Hi,

When I run this script:

<?php
session_start();
$_SESSION['test'] = "Session er smart";
echo $_SESSION['test'];
?>

I get this error-message:

Warning: session_start() [function.session-start]: Cannot send session
cookie - headers already sent by (output started at
/hotel/svp/WWW/html/php/auth.php:9) in /hotel/svp/WWW/html/php/auth.php on
line 10

Warning: session_start() [function.session-start]: Cannot send session cache
limiter - headers already sent (output started at
/hotel/svp/WWW/html/php/auth.php:9) in /hotel/svp/WWW/html/php/auth.php on
line 10
Session er smart

You can't send anything to the browser before starting your session, not even a
single blank line or space. Make sure your file starts like this:

-------------Start of file---------------------
<?PHP
session_start();

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #5

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

Similar topics

2
by: Rea | last post by:
Hi! I've searched high and low for this on the net but stil haven't found an answer. I'm trying to install both postnuke and xoops on a win2k server with php 4.3.3. and mysql installed. ...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
9
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
2
by: lookee | last post by:
Hello all, I have simple PHP application that on one page strarts session and write some information to it. On another page program tryes to fetch information from a third page using cURL. On that...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
11
by: Bocah Sableng | last post by:
Hi, I'm new member of this group. I had added new virtual host at my intranet server. The new virtual host configuration on httpd.conf is similar with the old one. At the new virtual host, the...
11
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
7
by: gowthamkg | last post by:
For the following code when ever i open the this page the text box has / i ahve set the value of text box with session variables whic is exuted only when submit button is clicked....Pls Help me.......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.