Bug 39485

Summary: Nested file extensions, If file names include .php, the file will be run as x-httpd-php even if the true file extension is other (ex: .txt)
Product: Apache httpd-2 Reporter: Webhead <bridgemonkey>
Component: CoreAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 2.5-HEAD   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
URL: http://liboss.westlib.asu.edu/files/blah.php.phps.txt

Description Webhead 2006-05-04 18:47:53 UTC
In Apache 2, php files with nested extensions such as .php.phps.txt or
.phps.php.txt will run as a x-httpd-php. All other extensions are ignored even
if the true file extension is .txt or .phps or even .pl. No matter where it's
placed, if the .php is found in the file name, it is run as x-httpd-php.

I tried moving the "AddType application/x-httpd-php .php" to the bottom of the
list just for kicks, but it made no difference.
Comment 1 Ruediger Pluem 2006-05-04 20:50:09 UTC
Have you checked if this happens also with php files that you name
somename.tst.txt and adding AddType application/x-httpd-php .tst to your
configuration? No fingerpointing, but in most cases these kind of reports turn
out to be php bugs.
Comment 2 William A. Rowe Jr. 2006-05-04 21:21:57 UTC
File name components have always been ordered (1st to last) with the last
one replacing the mime control and filter control of the previous segment.

99% certain you are either setting AddHandler conditionally on file-type,
which is problematic unless you also set AddHandler conditionally on every
stock file type (e.g. .txt) replacing the original.

Secondly, you can change the handler by the AddType application/x-httpd-php .php
you mentioned which is good - if that's your only override.

Please review and ensure you have AddType text/plain .txt to override the
AddType application/x-httpd-php metadata!

Make sure your httpd.conf file resolves mime.types

Bill
Comment 3 Nick Kew 2006-05-08 00:20:56 UTC

*** This bug has been marked as a duplicate of 29090 ***