~n[EO]n~ Posted October 5, 2007 Share Posted October 5, 2007 Here is my problem : Just need solution... In my menu page, i need to fetch one image from database and that file is included in the homepage. menu.php is the included file, here i have to fetch the image . index.php is the file where menu.php is included, and header file is also included <tr> <td><?php include("includes/menu.php"); ?></td> </tr> And when i open it it gives error Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at session is automatically started from config.php file and it is inclued in contact.php page require_once("config.php"); require_once("user_info.class.php"); and when i keep include("config.php"); in menu.php file it gives error. Is there some way where i can keep the config.php file so that it works for all pages... any help Quote Link to comment https://forums.phpfreaks.com/topic/71923-warning-session_start-problem/ Share on other sites More sharing options...
Mad Mick Posted October 5, 2007 Share Posted October 5, 2007 Not quite sure I understand what you mean but it sounds similar to a post I answered just recently. Don't forget that when you put session_start() in an included or required file it will effectively appear in the middle of the original php file and so will break the rule that it must appear before any output. If the first thing in your php file was require_once("config.php") and then session_start() was the first thing in your config.php file then you should be ok. Quote Link to comment https://forums.phpfreaks.com/topic/71923-warning-session_start-problem/#findComment-362329 Share on other sites More sharing options...
MadTechie Posted October 5, 2007 Share Posted October 5, 2007 please read the Header Pinned Post basically you have sent data to the screen before using session_start() in fact it tells you that the data was sent from in the message "headers already sent (output started at ######" working example <?php session_start(); echo "Hi Mom!"; ?> Failed example <?php echo "Hi Mom!"; session_start(); ?> thats that echo could be in an include used before the session_start(); Quote Link to comment https://forums.phpfreaks.com/topic/71923-warning-session_start-problem/#findComment-362347 Share on other sites More sharing options...
Mad Mick Posted October 5, 2007 Share Posted October 5, 2007 Seems to be a few people that remember to put the session_start() at the beginning of their code but then include that file in some other php file causing the headers already sent message. It might be worth updating the sticky post to specifically mention this. Quote Link to comment https://forums.phpfreaks.com/topic/71923-warning-session_start-problem/#findComment-362349 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.