HOME       >>       Programming

Warning In Php


goldrain

after you have uploaded your site to a web server, sometimes you will find a strange message in your site when you open it:

 

 

- Warning: session_start(): Cannot send session cookie - headers already sent by (output started at ...............

- Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at ...........

- Warning: Cannot modify header information - headers already sent by (output started at...........................

 

I tried to analyse what false that happened in that script, here are the result :

 

>> all things that happen above caused by

1.there are blank lines in the end of your script after "?php>" code. better if you try to upload with ASCII mode for pages.

2.The PHP function such as headers(), used with start_session(), produces HTML headers. When the PHP fragments are placed in the body of the HTML, this causes errors because the PHP fragments are trying to put HTML headers within the HTML body. Put the PHP fragments before the HTML body tag.

 

I hope this is useful for you which has same problem with me before.


ghostrider

Thanks for posting this, last year I had such a hard time figuring it out! It was horrible, it took me about 2 days to figure out I had a blank line on the top of my script.


electron

Well actually if u wnat to use sessions on your site it must be called before anything and after <?php .Then you may do whatever you want to do with headers.session_start() must be called first in any circumstance or the ERRORS.



VIEW DESKTOP VERSION REGISTERGET FREE HOSTING

Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.