2

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.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Ondrej Slinták
  • 31,386
  • 20
  • 94
  • 126
  • When the error page is turned of, what would you rather have happen instead? – Pekka Mar 28 '10 at 12:55
  • Nothing. I use my own custom error pages. For example: if something goes wrong, I call new ErrorPage( 500 ); . So the current problem is, that I modify headers for error 500, I get my customized error page and bellow that appended this Apache error page. I'd like to get rid of it. – Ondrej Slinták Mar 29 '10 at 07:36
  • Have you tried looking through all the config options in the administration console? Maybe it's an option. It's very likely that the default zend server configuration disables the ability of overriding the errordocument directive in .htaccess files. Apache has a very powerful permission system for saying where you can configure what, etc.. I would ask at the Zend Forums, actually. You're bound to get better answers :) And then post your answer here. – arnorhs Apr 04 '10 at 14:37
  • Well, yeah. I actually checked the options in ZendServer admin center, but I'm not sure if I'm looking for the right thing. But good idea, I'll try to ask on Zend forums and then answer here. – Ondrej Slinták Apr 04 '10 at 15:56
  • I had this same problem (with 404 pages, because Apache is intercepting the status code for some reason), got pissed off, and gave up on it. Since it was a test environment, I just set `ErrorDocument " "`, but that's no solution...Maybe I should take another look at what's going on. Does ZendServer 4 use PHP under FastCGI, by the way? – Tim Stone Aug 12 '10 at 11:38

2 Answers2

0

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

avetisk
  • 11,651
  • 4
  • 24
  • 37
  • 1
    He's on Zend Server so the Apache documentation doesn't apply. – Pekka Mar 28 '10 at 12:51
  • 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) – avetisk Mar 28 '10 at 12:55
  • 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 Apr 01 '10 at 10:24
  • 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? – avetisk Apr 02 '10 at 05:50
  • 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 Apr 03 '10 at 09:54
0

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
  • 10,383
  • 2
  • 35
  • 38
  • 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 Apr 01 '10 at 20:57
  • Hey, that's actually easy. I've modified my answer. – arnorhs Apr 02 '10 at 19:46
  • 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 Apr 03 '10 at 09:55