Problem with output_buffering and php.ini

Deadly 提交于 2019-12-06 17:54:25

Presumably, the page you hit immediately after logging in does a redirect.

Doing a redirect requires outputting an HTTP header with the response. The problem is, if PHP has already begun outputting the body of the document, it cannot then output a header because they headers ended when the body started.

Output buffering prevents PHP from outputting any part of the body of the document until the output buffer is flushed (or PHP exits). This allows you to output headers at any time.

Now, if turning output buffering on fixed the problem on own site/server, but not on another, that's a clear indication that it isn't actually the same problem - you are encountering a different problem.

You should be logging PHP errors, so check your PHP error log. If (and only if) you are viewing this on a restricted developers-only site (which you aren't), you may turn on display_errors in your PHP configuration, which will display errors on the page as it is rendered. This is generally considered an unsafe setting on publicly accessible servers, because of the potential for attackers to try and cause an error for which the error message reveals some private information.

I'm no expert and I can't understand what output buffering as to do with anything, maybe there are some errors in the code?

Could you create an .htaccess file with the following content:

php_flag display_errors on
php_value error_reporting 30719

Place it in the root folder of that site and then try to log in again to see if there are any output errors?

I had also got the same problem while working on a project. I fixed it later by setting output_buffering = 4096 in php.ini configuration file and it worked fine in localhost but when i put it on host server, i got this error again. I am not sure how to use my own php.ini configuration file on host server. Any suggestion are welcome...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!