Sunday, 29 April 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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...