473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.sessio n-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.sessio n-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 47079
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.sessio n-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.sessio n-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************ *************** *************** @spamyourself.c om>
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.sessio n-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.sessio n-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***@glassgian t.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
4566
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. Both applications are loading terribly slow. When the page finally has been rendered I got the following error:
10
3490
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 more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout...
9
9763
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 retrieve the image from the session object, convert it back to an image, and re-save it to the database? Thanks?
14
2354
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 User B has access to 5, now when both of us hits to the server at the same time then their session variables gets mixedup means either User A and...
2
14679
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 third page program needs to retrive information that were written to the session and use them. Problem is that when I call the third page and call...
0
2461
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 the following information: intProdID -- ProductID strProdName -- Product Name intQuant -- Quantity intProdPrice -- Price productType -- Type of...
11
13124
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 session id seems changed every interaction to server (new page or reload). The old one is fine, the session id keeps at the same string. Both are at...
11
2336
by: Sylvia A. | last post by:
How can I define global classes in web application ? Classes can be set to session variables ? Thanks
11
26546
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 and PEAR is in c:\wamp\php\pear I modified php.ini in the c:\wamp\php directory to reflect the actual path, but even stopping and restarting my...
7
2021
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.... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
0
7704
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7931
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8139
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7684
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7985
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5515
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3666
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3659
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.