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.
Update: conf-enabled/serve-cgi-bin.conf is activated. Here's part of my VirtualHost configuration: