FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


A warning with header





eudbase
I have written some PHP script for some of my webpages. I have found that some of the pages that share almost the same codes have shown the following script at the page when browse. May I know what is the problem if I get this warnings?

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

Can I turn off the warning that shown? Because I feel very annoying to see this script in my webpages.
Gushe
you can put an '@' in front of the line that causes the error.
But you might want to know that the header function that is sending Cache Limits aint't working properly. Smile
imagefree
eudbase wrote:
I have written some PHP script for some of my webpages. I have found that some of the pages that share almost the same codes have shown the following script at the page when browse. May I know what is the problem if I get this warnings?

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

Can I turn off the warning that shown? Because I feel very annoying to see this script in my webpages.



Instead of turning off this error message, you should look for and try to solve the problem. We can help you out for this and its easy to remove this problem.


Just post all the script starting from the beginning till the line

session_start();
rvec
or use this to buffer the output till the headers are send:
http://nl2.php.net/ob_start
sonam
Session are send warnings if is anything sended to browser before session_start(). For example, if you have one empty place before <?php on very top of the page this is enought for warning.

Sonam
eudbase
I found the source of problem already.. It is the position of my include coding which include the header file with session_start() in it. That is why the some pages show the warning and some of them none. Thanks for the advices.
swizzy
set error notification to E ^ NONE in php files... but thats just a dirty trick to supress the message, instead try to locate the problem and fix it Smile
AOP Web Development
i guess it would be the best to solve what cause the error, and i've learn here on the sticky post that it would be best if you put error_reporting ( E_ALL ); to see the notice or warning error, it's a good practice if you can enhance your coding techniques. hope it helps Wink

By the way on your problem there might be ouput an html before your you start your session_start();
might be you can use ob_start(); and ob_end_flush();
Related topics
HELP: setcookie() and header problems
PHP NUKE
Header("Location: PROBLEM");
PHP header command
Warning: Cannot modify header information...
Warning: fread(): [problem solved]
phpBB header problem.
Header phase problem
Header redirect problem
Warning: Cannot modify header information
Header problems
warning: cannot modify header information
Php Warning: fopen
header already sent? (and now introducing a mysql problem)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.