I think that most of the php beginners will facing a common problem on PHP session getting a warning message like this when using sessions.
Warning: session_start() [function.session–start]: Cannot send session cache limiter – headers already sent……
For this warning there are many reasons and few fixes that can be overcome this problem.
1.HTML Tags before the Session_start();
Always the PHP session should be initialized before any other output in your PHP page. Especially HTML tags when you are using a HTML editor like Microsoft expression web HTML tags can be automatically generated because the session initialization.
2. White spaces and unwanted characters
Some this before the or after the PHP tags there may be unwanted spaces or characters generated.
3. echo before session_start();
Print any output before the session initiation will generate this warning
Simply make sure that above things doesn’t happen.!!
Still got the error? Have a FIX!
If you still got the error a small trick that you can do is there! If you can’t fix it avoid it, as this is a warning message this is not affect the run time! So you can just ignore the error message like this:
<?php @session_start(); ?>
Put a @ before the session_start(); so this will ignore the error message !