Sunday, April 29, 2018

Cannot modify header information - PHP










I have built a website with lots of functions supported by programming. As the website is growing bigger, I found when doing photo upload, login, the following errors appear:-





Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in /var/www/web92/web/li/sli.php on line 63



Warning: Cannot modify header information - headers already sent by (output started at /var/www/web92/web/index826.php:62) in /var/www/web92/web/li/sli.php on line 72




I found adding ob_start(); at the very beginning of index can solve the problem, however, I would like to learn, if the running of php codes may have length limit.


Answer



The message





output started at /var/www/web92/web/index826.php:62




means that you have already written out content and the server has begun streaming the response to the client. You cannot modify the headers because they have already been sent.



Move the header-generating code to a point before the very first output is written.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...