header() error not shown in php

人盡茶涼 提交于 2019-12-02 09:40:35

You don't see the error because
a. output buffering is on
b. the server ignores your error_reporting function because something else instructs it otherwise run phpinfo(); and see what it says there about output buffering and about error_reporting.

This might be possible because you write into an output buffer (ob_start) which doesn't actually return anything to the client until you explicitly flush the buffer (ob_flush or ob_end_*) or the script ends.

The fact that you can't send headers after you begun writing the body part of your HTTP response is not a php but a HTTP protocol limitation, so this cannot be version specific either.

Many frameworks like the Zend Framework use output buffers so a developer doesn't need to care about the order.

I found the problem, I don't use any FrameWork.

the problem was error_reporting('E_ALL');

I wrote this code on first of my program, and so PHP didn't return any errors ! I deleted this line and I get the errors !

This is kidding because this line said to PHP to show ALL errors ! I don't know why PHP don't show any errors.

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