How to turn off default HTTP status code errors in Zend Server?
Every time I return some status code in my PHP code, Zend Server gives me following error appended on the bottom of my website (with the message of HTTP code I returned). So for example, if I return 401, it gives me another 401 error appended to my 401 page:
Is there any way to turn it off? I use Zend Server Community Edition 5.0 with PHP 5.2.
EDIT:
It seems to be default Apache error handling. Is there a way to disable it? Preferably without having my own error pages.
ADDITIONAL EDIT:
I tried to edit my .htaccess with ErrorDocument directives. It still gives me my error page (blank page) + Apache error (like on screenshot above).
This isn't happening with ZendServer 4 I have on server. I use ZendServer 5 on localhost tho. Is it possible to be some kind of bug or misconfiguration from Zend side?
BEHAVIOUR:
(In all test cases I return 401)
When I use default ZendServer configuration + ErrorDocument directives in .htaccess, I get my own error page + Apache error page appended bellow it.
When I use default ZendServer configuration + disable my own ErrorDocument directives, I get just Apache error page.
When I change Apache error pages to开发者_如何学Go blank files + use my own ErrorDocument directives, I get the desired behavior, however errors 404 still append default Apache errors bellow my own.
As you can see on the Apache httpd documentation page, you can't disable it.
If you just want no output you have two choices:
# you *HAVE TO* to put at least one character (here it's a space)
ErrorDocument <errorcode> `' '`
# if you really want to have 0 character, use a blank file
ErrorDocument <errorcode> /var/www/blank
Though you have to this for each error code you want to "disable".
You can make these changes in the httpd server's conf file or in a .htaccess file or a VHost (though I don't know where are the conf files in Zend Server).
I don't think you'll necessarily want to "disable" that error. What you need to do is find out what error is being reported (go through the log file) and then you'll probably find a permission issue or a PHP script that's actually failing and dumping it's core.
To override a default error page in apache, you can place the following line in an .htaccess file or in you httpd.conf config.
ErrorDocument 401 /path/to/the/new/error/page.html
that applies to all error pages you want to override. So just change the status code to 503 for those errors..etc..
More info in the apache documentation: http://httpd.apache.org/docs/1.3/mod/core.html#errordocument
精彩评论