Why is Apache executing .php.html files as PHP?

前端 未结 3 809
庸人自扰
庸人自扰 2020-12-21 05:56

I have an odd problem...I\'m using a documentation generator which generates a lot of output like docs/foo.php.html. It\'s XHTML, and thus contains

相关标签:
3条回答
  • 2020-12-21 06:13

    You could disable PHP's shorttags -- this is the recommended way to mix PHP and XML.

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

    short_open_tag = 0
    
    0 讨论(0)
  • 2020-12-21 06:22

    The problem seems to be in mod_mime.

    Quote from the Apache mod_mime documentation page:

    If you would prefer only the last dot-separated part of the filename to be mapped to a particular piece of meta-data, then do not use the Add* directives. For example, if you wish to have the file foo.html.cgi processed as a CGI script, but not the file bar.cgi.html, then instead of using AddHandler cgi-script .cgi, use

    <FilesMatch \.cgi$>

    SetHandler cgi-script

    </FilesMatch>

    Also, you can google for apache mod_mime "multiple extensions"

    0 讨论(0)
  • 2020-12-21 06:31

    Are .html files listed as being allowed to be parsed as PHP? I've seen some shared hosts set .html files to be usable as a valid PHP extension which may also be catching your .php.html files.

    0 讨论(0)
提交回复
热议问题