Why does Apache execute .php.html files like PHP?

I have a strange problem ... I use a documentation generator that generates a lot of output, such as docs / foo.php.html. This is XHTML, and therefore contains tags <?xml...>at the beginning of the file. The problem is that Apache somehow decided to run it through the PHP interpreter, although ".php" appears in the middle of the file name, not at the end. This, in turn, causes a PHP error because it sees " <?" as a command to start executing the PHP code, and immediately gets confused by the " xml..." that follows it.

How to configure Apache to ONLY execute .php files, not .php.html files? The string "php.html" does not appear explicitly anywhere in my Apache configuration files. There is a line " AddHandler php5-script .php", but I do not see how this would also include the files ".php.html".

+4
source share
3 answers

The problem is mod_mime .

Quote from the Apache mod_mime documentation page:

, Add *. , , foo.html.cgi CGI script, bar.cgi.html, AddHandler cgi- script.cgi

<FilesMatch \.cgi$>

SetHandler cgi-script

</FilesMatch>

, google apache mod_mime "multiple extensions"

+11

PHP - PHP XML.

http://us.php.net/ini.core

short_open_tag = 0
+3

.html PHP? , .html PHP, .php.html .

-1

All Articles