Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm having the following issue on a host using Apache 2.2.22 + PHP 5.4.0

I need to provide the file /home/server1/htdocs/admin/contents.php when a user makes the request: http://server1/admin/contents, but I obtain this message on the server error_log.

Negotiation: discovered file(s) matching request: /home/server1/htdocs/admin/contents (None could be negotiated)

Notice that I have mod_negotiation enabled and MultiViews among the options for the related virtualhost:

<Directory "/home/server1/htdocs">
    Options Indexes Includes FollowSymLinks MultiViews
    Order allow,deny
    Allow from all
    AllowOverride All
</Directory>

I also use mod_rewrite, with the following .htaccess rules: RewriteEngine On RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^\./]*)$ index.php?t=$1 [L]
</IfModule>

It seems very strange, but on the same box with PHP 5.3.6 it used to work correctly. I'm just trying an upgrade to PHP 5.4.0, but I cannot solve this negotiation issue. Any idea on why Apache cannot match contents.php when asking for content (which should be what mod_negotiation is supposed to do)?

UPDATE: I noticed that mod_negotiation behaves correctly with files with extension different than .php: so if I'd have a file named /admin/contents.txt, I can access it regulary with the browser with /admin/contents url. So the problem is only for php files. Any clue on what could make the negotiation fail?

share|improve this question
    
How do you configure mod_negotiation? Are you using it? –  Mircea Vutcovici Mar 23 '12 at 13:56
    
Well I just include mod_negotiation in httpd.conf, then the MultiViews options in the VirtualHost should be enough to do what I'm looking for, as far as I know.. isn't it? –  lorenzo.marcon Mar 23 '12 at 13:58
add comment

2 Answers 2

up vote 14 down vote accepted

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.

share|improve this answer
3  
This! This right HERE! Spent most of the night hunting down why I was getting the very unhelpful "Discovered File(s)/None Negotiated" error. Scripts had been working fine before, and I had a devil of a time tracking down the fact that the type wasn't being included in mod_mime on the distribution I was testing on. I owe you a beer sir. –  Akoi Meexx Feb 19 '13 at 3:22
    
I'll gladly accept your beer when I'll come to US :) –  lorenzo.marcon Feb 19 '13 at 10:21
    
this works perfectly!! @lorenzo.marcon thanks for the question and answer! –  rogcg Jun 27 '13 at 1:50
    
This must have changed at some point. I'm feeling pretty confident I didn't need to add this earlier for php MultiViews to work. –  user1338062 Sep 24 '13 at 15:44
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.