woodplease Posted October 16, 2010 Share Posted October 16, 2010 i keep getting this error whenever i load my page Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\wiki\index.php:1) in C:\xampp\htdocs\wiki\index.php on line 2 <?php session_start(); include "includes/dbconnect.php"; include "includes/functions.php"; forum_connect(); ?> <!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"> <head> <link rel="stylesheet" type="text/css" href="../style.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Wiki</title></head> <body id="page1"> <div id="header"> <div class="container"> <div class="logo"> <a href="index.html"><img src="images/logo.gif" alt="logo" /></a> </div> i've made sure that session_start() is at the very top, and there are no rogue spaces or breaks , so i dont know why i'm getting the error. any ideas? thanks Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 16, 2010 Share Posted October 16, 2010 See reply #2 in this sticky post - http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122732 Share on other sites More sharing options...
woodplease Posted October 16, 2010 Author Share Posted October 16, 2010 i've looked through that thread, and it the suggestions dont solve the problem Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122737 Share on other sites More sharing options...
BlueSkyIS Posted October 16, 2010 Share Posted October 16, 2010 from post 2: These types of commands need to be placed (preferably towards the top) prior to any HTML or output sent in your script. So, do not send ANYTHING to the browser prior to using these commands. Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122738 Share on other sites More sharing options...
woodplease Posted October 16, 2010 Author Share Posted October 16, 2010 thats what i've done, the first two lines of the page are <?php session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122741 Share on other sites More sharing options...
BlueSkyIS Posted October 16, 2010 Share Posted October 16, 2010 hm.... not apparently: <?php session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122742 Share on other sites More sharing options...
woodplease Posted October 16, 2010 Author Share Posted October 16, 2010 well i just checked again, and it definately is Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122744 Share on other sites More sharing options...
PFMaBiSmAd Posted October 16, 2010 Share Posted October 16, 2010 Your problem is likely the BOM characters. Save your file without the BOM characters or save it as an ANSI/ascii encoded file. @BlueSkyIS, the forum's [ php ] tag menu item messes up the code that is posted by adding all kinds of tabs/newlines, so you cannot go by what gets posted through that method. i've looked through that thread, and it the suggestions dont solve the problem Yes, well you didn't bother to state what you tried. Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122753 Share on other sites More sharing options...
woodplease Posted October 16, 2010 Author Share Posted October 16, 2010 i think i've removed all of the bom characters, but its still not working i've posted the entire code in case anyone can see the error <?php session_start(); include "includes/dbconnect.php"; include "includes/functions.php"; forum_connect(); ?> <!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"> <head> <link rel="stylesheet" type="text/css" href="../style.css" /> <title>Wiki</title></head> <body id="page1"> <div id="header"> <div class="container"> <div class="logo"> <a href="index.html"><img src="images/logo.gif" alt="logo" /></a> </div> <?php nav_menu3(); ?> </div> </div> <div id="main"> <div id="content"> <div class="mainBanner"> <div class="indent"> <h1>SiFi Wiki<strong>Get your data here!</strong><strong></strong></h1> </div> </div> <div class="wrapper"> <div class="aside left"> <div class="inside"> <h3>Menu</h3> <ul class="list1"> <li> <?php menu(); ?> </ul> <a href="news.php">Read More... </a></div> </div> <div class="mainContent"> <div class="section"> <div class="box"> <div class="top"> <div class="bot"> <div class="inner"> <h2><img src="images/icon1.gif" alt="" /><strong><br/>Wiki's</strong><br/></h2> <?php $entry = mysql_query("SELECT * FROM entry ORDER BY entry_title") or die ("Query failed"); $numofrows2 = mysql_num_rows($entry); for($j = 0; $j < $numofrows2; $j++) { $row2 = mysql_fetch_array($entry); echo "<a href='view_entry.php?wiki={$row2[entry_title]}'>".stripslashes($row2[entry_title])."</a> "; echo "<br/>"; } ?></div> </div> </div> </div> </div> </div> </div> </div> <div id="footer"> <?php login(); ?> <a href="about.html">About</a> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/216011-session_start/#findComment-1122772 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.