MasterACE14 Posted December 22, 2009 Share Posted December 22, 2009 Hello, This is rather complicated to explain, so I'll keep it short and simple as possible. I have 4 files involved in my problem(hopefully that's all): index.php leftpanel.php javascript.js system.php index.php has a #left div in it, by the use of AJAX (jQuery) in javascript.js, leftpanel.php is loaded into the #left div. In leftpanel.php the file system.php is included. In system.php is session_start(); and a few other includes as well as connection to the MySQL database. Now the problem is I'm getting the following error coming up in the #left div and the entire website Doubles itself (can see the website twice, with 1 overlapping the other) here's the error: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\xampp\htdocs\conflictingforces\index.php:97) in C:\xampp\xampp\htdocs\conflictingforces\system.php on line 33 Line 33 of system.php is: session_start(); line 97 of index.php is: </html> the very last line in the index.php file... I'm completely lost as to why I'm getting this error. And not sure as to what code is relevant to show? leftpanel.php simply has system.php included at the top, and then has a navigation menu, a session var check to determine what nav menu to show. system.php is just includes, connection to mysql and session_start(); at the end of the file. index.php has #left, #contentmain and #right divs which each have PHP files loaded into them by the use of jQuery AJAX found in javascript.js. Any help at all is extremely appreciated, this has been a pain for a couple months now. Thank you in advance! Regards, Ace Link to comment https://forums.phpfreaks.com/topic/185970-sessions-dont-like-my-output/ Share on other sites More sharing options...
trq Posted December 22, 2009 Share Posted December 22, 2009 session_start cannot be called after any output is sent to the browser. Link to comment https://forums.phpfreaks.com/topic/185970-sessions-dont-like-my-output/#findComment-982020 Share on other sites More sharing options...
MasterACE14 Posted December 22, 2009 Author Share Posted December 22, 2009 yeah I know, but from what I've learnt, I can't simply put session_start(); at the top of index.php as that won't apply to the files loaded asynchronously into #left, #contentmain and #right by the AJAX requests. So I have session_start(); at the very top of the files loaded into those divs, before any of the output in those files. Which does work if I just have session_start(); at the top of each of them. But as soon as I include my system.php, it says there is output, which there shouldn't be as far as I can tell. system.php looks like this... <?php $mysql['database'] = "************"; $mysql['user'] = "******"; $mysql['pass'] = "********"; // include GET engine require_once("GETengine-1.0.0/index.php"); // start basic initializations // set error reporting level //error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ALL); // include configurations require_once("config.php"); // include core functions require_once("security.php"); require_once("functions.php"); // connect to database $link = mysql_connect("localhost",$mysql['user'],$mysql['pass']); if(!$link) die(DieError("Could not connect to MySQL! ".mysql_error())); $conn = mysql_select_db($mysql['database'],$link); if(!$conn) die(DieError("Could not select database! ".mysql_error())); // includes require_once("includes.php"); session_start(); // start session ?> ---EDIT--- Commenting out require_once("GETengine-1.0.0/index.php"); seems to fix the problem. The GET engine consists of several classes and functions that are used on the website. I'm not really sure how that is affecting the sessions as there is no output from it? Link to comment https://forums.phpfreaks.com/topic/185970-sessions-dont-like-my-output/#findComment-982043 Share on other sites More sharing options...
trq Posted December 22, 2009 Share Posted December 22, 2009 Well, somewhere along the line you are outputting prior to calling session_start(), you need to track it down, I can't really see how we can help you. The error say its line 97 of your index page. Link to comment https://forums.phpfreaks.com/topic/185970-sessions-dont-like-my-output/#findComment-982045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.