views:

319

answers:

3

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:

alt text

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 blank files + use my own ErrorDocument directives, I get the desired behavior, however errors 404 still append default Apache errors bellow my own.

A: 

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).

avetis.kazarian
He's on Zend Server so the Apache documentation doesn't apply.
Pekka
Zend Server is based on a Apache httpd server: "If you don't speak Geek, I'll translate that for you: it's a pre-packaged version of Apache and PHP that gets a simple PHP environment up and running with minimal effort on your part." (from http://devzone.zend.com/article/4295)
avetis.kazarian
I tried to apply ErrorDocument directives into my .htaccess with not much success. I still get some other custom errors appended to my webpage + ErrorDocument pages I defined in htaccess.
Ondrej Slinták
I guess I'll try to install Zend Server on my own machine and get the same error as you. Could you provide your OS version and also Zend Server exact version?
avetis.kazarian
It's Windows XP and ZendServer 5.0 with PHP 5.2: http://www.zend.com/en/products/server/downloads?hpb=Server5_GA (first download link).
Ondrej Slinták
A: 

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

arnorhs
I think my wording was bit confusing (already edited my original post). There's nothing failing, I do want that page to be 401, I just want there to be just my own custom 401 error, without the default Apache one appended bellow it.
Ondrej Slinták
Hey, that's actually easy. I've modified my answer.
arnorhs
Yeah, well, it's not that easy. I have exactly this in my .htaccess right now and it's not working. I'm still getting one more error appended to it :/
Ondrej Slinták
I edited my original post once again. Please, see it.
Ondrej Slinták
A: 

to me there is no real solution to this. right? if i send 302 moved and then header(location...) apache still sends out the 302 generic errordocument. before i used php as CGI there was no problem with that. if i enable deflate, this additional appended data will end up in a content encoding error. that's really annoying.

bennson