Tell me more ×
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

2 Answers

up vote 7 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
2  
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 at 3:22
I'll gladly accept your beer when I'll come to US :) – lorenzo.marcon Feb 19 at 10:21

I think that http://stackoverflow.com/a/602355/290087 might answer your question.

share|improve this answer
4  
Actually, that answer suggest to disable MultiViews, while I actually want to exploit the features that MultiViews provides – lorenzo.marcon Mar 24 '12 at 10:31

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.