TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 10-08-2009, 10:16 AM   #1 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default Sessions

I have developed a website on my laptop using php5 and recently moved it to a hosted environment. I now keep getting loads of errors around session handling such as "Cannot send session cache limiter - headers already sent". I corrected a few by removing spaces from the bottom of php scripts after the ?> php end command however they are everywhere and i never got any issues like this on my laptop. Both the laptop and the shared hosting environment are php5 but probably different versions. Any idea why this wasnt a problem on my laptop can I suppress this errors or something?
captainmerton is offline  
Reply With Quote
Old 10-08-2009, 06:19 PM   #2 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

"headers have already been sent" means that output has been sent to the client. Cookies, meta data, sessions and things of that sort can not be modified after the output has already been sent. Make sure that anything which modifies it is before the first bit of output.

I tend to avoid sessions, they are too often unreliable, especially in larger environments that are not managed by pros.
__________________

Village Idiot is offline  
Reply With Quote
Old 10-08-2009, 08:57 PM   #3 (permalink)
The Contributor
 
ioan1k's Avatar
 
Join Date: Mar 2009
Location: US
Posts: 76
Thanks: 0
ioan1k is on a distinguished road
Default

Code:
?>
A good practice to follow is to exclude this from your code, to avoid future problems such as this one ...

And the error should include where the data is being sent ( File & Line ) before the session is started
__________________
My Portfolio - Work - Need freelance Work?
I've been developing 5 years now, and I learn something new everyday
ioan1k is offline  
Reply With Quote
Old 10-09-2009, 10:46 AM   #4 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default

What do you mean by "exclude this from your code"?
captainmerton is offline  
Reply With Quote
Old 10-09-2009, 01:00 PM   #5 (permalink)
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

He means take the ending PHP tag out of your PHP files. This prevents you from accidentally having white space after the ending tag that ends up getting output to the screen.
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sessions and security/maintenance delayedinsanity General 3 05-07-2008 06:09 AM
Is this a good idea? (Sessions & Cookies manipulation) read Nor General 2 03-28-2008 03:05 PM
Sessions & Functions Rendair Advanced PHP Programming 8 01-14-2008 10:57 AM
Php sessions? Edwin General 2 01-08-2008 01:40 PM
Understanding the Life of a Session Wildhoney General 6 10-27-2007 02:34 AM


All times are GMT. The time now is 07:14 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design