Apache file negotiation failed
I found the solution. Very easy, indeed. I forgot to include the following:
AddType application/x-httpd-php .php
into apache mod_mime section into httpd.conf
I was misled by the fact that php scripts were correctly working; however the negotiation was failing because mod_negotiation only looks for "interesting" (and known) file types.
I had the same problem after updating from Debian Squeeze to Wheezy. The mods-enabled/mime.conf
includes the known file types from the system:
TypesConfig /etc/mime.types
The problem was that the /etc/mime.types
file was replaced by the update and in the replaced file, the PHP part was commented out. When searching for it, I found:
#application/x-httpd-php phtml pht php
#application/x-httpd-php-source phps
#application/x-httpd-php3 php3
#application/x-httpd-php3-preprocessed php3p
#application/x-httpd-php4 php4
#application/x-httpd-php5 php5
I had to remove the #
from each line containing php-relevant stuff, then save and restart the Apache web server. That solved the problem without modifying the mime.conf
file.
Instead of mapping .php
to a media type (which can have security implications, as described in Debian Bug 589384 which disabled them), you can configure MultiviewsMatch
to match files without a type for .php
, as suggested in Mark Amery's answer to a similar question:
<Files "*.php">
MultiviewsMatch Any
</Files>
I had the same problem after updating from Debian Squeeze to Wheezy. The mods-enabled/mime.conf includes the known file types from the system:
TypesConfig /etc/mime.types
The problem was that the /etc/mime.types file was replaced by the update and in the replaced file, the PHP part was commented out. When searching for it, I found:
#application/x-httpd-php phtml pht php
#application/x-httpd-php-source phps
#application/x-httpd-php3 php3
#application/x-httpd-php3-preprocessed php3p
#application/x-httpd-php4 php4
#application/x-httpd-php5 php5
I had to remove the #
from each line containing php-relevant stuff, then save and restart the Apache web server. That solved the problem without modifying the mime.conf file.