Jay2391 Posted January 2, 2007 Share Posted January 2, 2007 I had this code on session_test.php and i created a session_test2.php to check that the session will continue. The same code is on session_test andsession _test2Code:<?php session_start(); if($_SESSION['session_var'] == "skipLogin"){ echo $_SESSION['fname']; echo "<br>--ACTIVE--"; }else{ echo "You stinky"; }?>Error:Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\XAMPP\xampp\htdocs\MDO\session_test2.php:2) in C:\XAMPP\xampp\htdocs\MDO\session_test2.php on line 3 Quote Link to comment https://forums.phpfreaks.com/topic/32594-solved-session-error/ Share on other sites More sharing options...
wildteen88 Posted January 2, 2007 Share Posted January 2, 2007 You have output on line2 in session_test2.phpIs <?php on line 1 in session_test2.php and there is nothing before <?phpIs there anything before <?php or if its not on line 1 then that is why. Quote Link to comment https://forums.phpfreaks.com/topic/32594-solved-session-error/#findComment-151589 Share on other sites More sharing options...
kenrbnsn Posted January 2, 2007 Share Posted January 2, 2007 The session_start() function [b][color=red]must[/color][/b] come before any output is sent to the browser. Is there anything before the "<?php"?Ken Quote Link to comment https://forums.phpfreaks.com/topic/32594-solved-session-error/#findComment-151591 Share on other sites More sharing options...
Jay2391 Posted January 2, 2007 Author Share Posted January 2, 2007 got it thanks Quote Link to comment https://forums.phpfreaks.com/topic/32594-solved-session-error/#findComment-151593 Share on other sites More sharing options...
Jay2391 Posted January 2, 2007 Author Share Posted January 2, 2007 BTW that was pretty dumb for PHP to do but i guess it make sence to them Quote Link to comment https://forums.phpfreaks.com/topic/32594-solved-session-error/#findComment-151595 Share on other sites More sharing options...
wildteen88 Posted January 2, 2007 Share Posted January 2, 2007 its not PHP whos dumb. Its to do with how the http protocol works. Read up on http headers to see how they work. Quote Link to comment https://forums.phpfreaks.com/topic/32594-solved-session-error/#findComment-151599 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.