ballouta Posted December 10, 2008 Share Posted December 10, 2008 Hello I have a logout page, i put this code at the most top of the page: <?php session_start(); session_destroy(); ?> But i got this error when i try to log out, please help. Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/dcompany/public_html/Login/logout.php:1) in /home/dcompany/public_html/Login/logout.php on line 1 Thank you Quote Link to comment Share on other sites More sharing options...
waynew Posted December 10, 2008 Share Posted December 10, 2008 Are you outputting to the screen before this code? <?php session_start(); session_destroy(); ?> Quote Link to comment Share on other sites More sharing options...
ballouta Posted December 10, 2008 Author Share Posted December 10, 2008 No at all there's nothing before those two lines line 1: <?php session_start(); line 2: session_destroy(); line 3: ?> Quote Link to comment Share on other sites More sharing options...
waynew Posted December 10, 2008 Share Posted December 10, 2008 Could you post the entire file? Quote Link to comment Share on other sites More sharing options...
ballouta Posted December 10, 2008 Author Share Posted December 10, 2008 this is all the page code <?php session_start(); session_destroy(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ar-lb"> <link href="../Store/style.css" rel="stylesheet" type="text/css" /> <link href="../Store/layout.css" rel="stylesheet" type="text/css" /> <title>Logout</title> </head> <body> <div class="main" id="page7"> <div class="menu"> <p style="text-indent: -30px"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="766" height="98"> <param name="movie" value="../flash/members.swf?button=0" /> <param name="quality" value="high" /> <param name="menu" value="false" /> <param name="wmode" value="transparent" /> <!--[if !IE]> <--> <object data="../flash/members.swf?button=0" width="766" height="98" type="application/x-shockwave-flash"> <param name="quality" value="high" /> <param name="menu" value="false" /> <param name="wmode" value="transparent" /> <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" /> FAIL (the browser should render some flash content, not this). </object> <!--> <![endif]--> </object> </div> <div id="content"> <div class="in1"> <div class="in2"> <div class="in3"> <div class="col1"> <p style="text-align: right; text-indent:25px" dir="rtl"> <img src="../images/spacer.gif" alt="" width="1" height="20" /> <p style="text-align: right; text-indent:35px" dir="rtl"> <b><font face="Tahoma" size="2" color="#FF0000">تسجيل خروج</font></b></p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> <b><font face="Tahoma" size="2" color="#44A30F">you ahve signed out successfully!</font></b></p> <?php echo "<META HTTP-EQUIV=\"refresh\" content=\"2; URL=http://www.CompanyName.com\"> "; ?> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px; line-height:200%" dir="rtl"> <img border="0" src="../images/spacer.gif" width="1" height="240"></p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; " dir="rtl"> </p> <!-- here it ends --> <!--here it ends --> </div> </div> </div> </div> </div> <div id="footer" style="width: 766px; height: 76px"> <div style="margin-left:45px; margin-top:11px;"> <p style="text-align: right; text-indent:25px" dir="rtl"> <font face="Tahoma"><a href="../index.php">الرئيسية</a></font> | <font face="Tahoma"><a href="../About~us.php">عن الدار</a></font> | <font face="Tahoma"><a href="../Store">الإصدارات</a></font> | <font face="Tahoma"><a href="../Members.php">الأعضاء</a></font> | <font face="Tahoma"><a href="../Search.php">البحث</a></font> | <font face="Tahoma"><a href="../Customer~Support.php">contact us</a></font><br /> </div> <br style="line-height:16px;" /> <div style="margin-left:45px;"> <p style="text-align: right; text-indent:25px" dir="rtl"> <font face="Tahoma" size="2" color="#7A7A7A">DMC Company</font></p> <p style="text-align: right"> </div> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
5kyy8lu3 Posted December 10, 2008 Share Posted December 10, 2008 this is all the page code <?php session_start(); session_destroy(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="rtl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ar-lb"> <link href="../Store/style.css" rel="stylesheet" type="text/css" /> <link href="../Store/layout.css" rel="stylesheet" type="text/css" /> <title>Logout</title> </head> <body> <div class="main" id="page7"> <div class="menu"> <p style="text-indent: -30px"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="766" height="98"> <param name="movie" value="../flash/members.swf?button=0" /> <param name="quality" value="high" /> <param name="menu" value="false" /> <param name="wmode" value="transparent" /> <!--[if !IE]> <--> <object data="../flash/members.swf?button=0" width="766" height="98" type="application/x-shockwave-flash"> <param name="quality" value="high" /> <param name="menu" value="false" /> <param name="wmode" value="transparent" /> <param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer" /> FAIL (the browser should render some flash content, not this). </object> <!--> <![endif]--> </object> </div> <div id="content"> <div class="in1"> <div class="in2"> <div class="in3"> <div class="col1"> <p style="text-align: right; text-indent:25px" dir="rtl"> <img src="../images/spacer.gif" alt="" width="1" height="20" /> <p style="text-align: right; text-indent:35px" dir="rtl"> <b><font face="Tahoma" size="2" color="#FF0000">تسجيل خروج</font></b></p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> <b><font face="Tahoma" size="2" color="#44A30F">you ahve signed out successfully!</font></b></p> <?php echo "<META HTTP-EQUIV=\"refresh\" content=\"2; URL=http://www.CompanyName.com\"> "; ?> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; text-indent:35px; line-height:200%" dir="rtl"> <img border="0" src="../images/spacer.gif" width="1" height="240"></p> <p style="text-align: right; text-indent:35px" dir="rtl"> </p> <p style="text-align: right; " dir="rtl"> </p> <!-- here it ends --> <!--here it ends --> </div> </div> </div> </div> </div> <div id="footer" style="width: 766px; height: 76px"> <div style="margin-left:45px; margin-top:11px;"> <p style="text-align: right; text-indent:25px" dir="rtl"> <font face="Tahoma"><a href="../index.php">الرئيسية</a></font> | <font face="Tahoma"><a href="../About~us.php">عن الدار</a></font> | <font face="Tahoma"><a href="../Store">الإصدارات</a></font> | <font face="Tahoma"><a href="../Members.php">الأعضاء</a></font> | <font face="Tahoma"><a href="../Search.php">البحث</a></font> | <font face="Tahoma"><a href="../Customer~Support.php">contact us</a></font><br /> </div> <br style="line-height:16px;" /> <div style="margin-left:45px;"> <p style="text-align: right; text-indent:25px" dir="rtl"> <font face="Tahoma" size="2" color="#7A7A7A">DMC Company</font></p> <p style="text-align: right"> </div> </div> </div> </body> </html> try moving the session_start(); down to the second line and get rid of that space, I can't think of anything else Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 10, 2008 Share Posted December 10, 2008 When the error refers to output at line 1 and you have removed or determined there is nothing before the <?php tag, your file is probably saved in UTF-8 encoding and the BOM (Byte Order Mark) characters at the start of the file is content sent to the browser and prevents headers from working. Save your file as ANSI/ASCII or if you must save it as UTF-8, save it without the BOM. Quote Link to comment Share on other sites More sharing options...
ballouta Posted December 10, 2008 Author Share Posted December 10, 2008 thanks I removed the UFT encoding line but the page still hve the same error. i changed the encoding to us-ascii also the same probem. very strange, i m sure that this page was working properly, why i am getting this error now? Quote Link to comment Share on other sites More sharing options...
linvo1986 Posted December 10, 2008 Share Posted December 10, 2008 try this(without ?>) <?php session_start(); session_destroy(); Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 10, 2008 Share Posted December 10, 2008 Post the current error message you are getting. Quote Link to comment Share on other sites More sharing options...
ballouta Posted December 10, 2008 Author Share Posted December 10, 2008 I replaced this logout.php page with another new one that contains only <?php session_start(); session_destroy(); ?> and still getting the same error as the one i mentioned before. thank you Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 10, 2008 Share Posted December 10, 2008 You either have content/characters before <?php or the BOM characters. If you tried to save the file without the BOM and you still got the error, then either that did not work or the file was not uploaded correctly onto the web server. Try it again. How are you uploading the file to the web server? If using FTP, make sure you are using ASCII mode and not binary mode. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 10, 2008 Share Posted December 10, 2008 Open the file in a text editor like notepad and you'll see why. Quote Link to comment 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.