You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Yves Goergen <no...@unclassified.de> on 2014/12/14 14:17:45 UTC

[users@httpd] ErrorDocument CGI not executing, source displayed

Hi,

On Apache HTTP server 2.2, the ErrorDocument has a PHP CGI script in my 
configuration which shows a nice message and reacts to multiple error 
codes and shows additional information for each. This works fine.

But after upgrading to version 2.4, it no longer executes. Instead, the 
full source code of that file is displayed, including the first line, 
see below. What's wrong here?

The config is pretty simple:

ErrorDocument 401 /cgi-bin/error.cgi
ErrorDocument 403 /cgi-bin/error.cgi
ErrorDocument 404 /cgi-bin/error.cgi
ErrorDocument 500 /cgi-bin/error.cgi

The file is owned by the correct user and group and is executable. It 
looks like this:

#!/usr/bin/php-cgi
<?
$errorCode = $_SERVER['REDIRECT_STATUS'];
$reqUrl = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
...

The access log contains the expected entry with the error code, like 500 
or 403. The error log tells me that the client was denied in my 
restricted directory, with is also expected.

But why is the error document file not executed at all anymore?

Apache version is from 2.2.x to 2.4.7 on Ubuntu 14.04.

-- 
Yves Goergen
http://unclassified.de
http://dev.unclassified.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org