The default apache configuration file installed with php 5 sets the server handler by nesting the "SetHandler" directive inside "FilesMatch" containers. Because of the way that those containers work it's somewhat difficult to manually override the handler or even troubleshoot why a file is being handled in a particular way. I propose that using a simple AddHandler instead is easier to deal with and even easier to read and understand when looking at config files. A good use case is if you have a virtual host on another port that you want to serve out with webdav for editing. You'll want those files to not be processed and instead served as plain/text. You would normally use a ForceType or RemoveHandler directive, but neither of these works with the default config because FilesMatch is evaluated very late in the order and overrides everything else. Reproducible: Always Steps to Reproduce: 1. Install with the default config files 2. Set up a location or directory where you want php files to be served without processing (as text) either for webdav or just simply for viewing purposes. Try to use the common ForceType or RemoveHandler directives to accomplish this. Actual Results: It will still parse and server-side process the php and send the output to the client Expected Results: That you could use these directives to stop the server-side processing of php files. This is what's in the default config: <FilesMatch "\.ph(p5?|tml)$"> SetHandler application/x-httpd-php </FlesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> and those six lines can be replaced with these two: AddHandler application/x-httpd-php .php .php5 .phtml AddHandler application/x-httpd-php-source .phps
You are right, I did not think of that at all, will change in the next revision.
One thing to keep in mind if implementing this: Using mod_mime's AddHandler causes the handler to be used if the filename *contains* the extension rather than *ends with* the extension. So a file mycode.php.html will be parsed as a PHP file when AddHandler is used, but not when the FilesMatch directive is used. This may be what people want, or it may not. But either way, this change is not without consequences, however minor they might be. For more info, see: http://httpd.apache.org/docs/2.2/mod/mod_mime.html#multipleext
The current in tree php-5.3.2 uses AddHandler like you suggested. Thanks.
I change AddHandler application/x-httpd-php .php .php5 .phtml AddHandler application/x-httpd-php-source .phps to AddHandler application/x-httpd-php5 .php .php5 .phtml AddHandler application/x-httpd-php5-source .phps