Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 阿帕奇<;档案>;及<;文件匹配>;httpd.conf中的受限范围_Php_Apache_Security_Httpd.conf - Fatal编程技术网

Php 阿帕奇<;档案>;及<;文件匹配>;httpd.conf中的受限范围

Php 阿帕奇<;档案>;及<;文件匹配>;httpd.conf中的受限范围,php,apache,security,httpd.conf,Php,Apache,Security,Httpd.conf,由于不允许使用此语法: <Files /path/to/the/file.php> Options +ExecCGI </Files> 选项+执行CGI 有没有办法限制httpd.conf中和指令的范围 这样它就不会传播到子目录了 我试过: <Directory /path/to/the> Options -ExecCGI <Files file.php> Options +ExecCGI </Files>

由于不允许使用此语法:

<Files /path/to/the/file.php>
  Options +ExecCGI
</Files>

选项+执行CGI
有没有办法限制httpd.conf中
指令的范围 这样它就不会传播到子目录了

我试过:

<Directory /path/to/the>
  Options -ExecCGI
  <Files file.php>
    Options +ExecCGI
  </Files>
</Directory>

选项-执行CGI
选项+执行CGI
单独或附加规则:

<Directory /path/to/the/*>
  Options -ExecCGI
</Directory>

选项-执行CGI
但是,这会传播到路径中的所有目录

这种用法的一个例子是默认情况下不允许使用ExecCGI选项,并允许它有选择地选择文件,而不需要在每个目录中使用.htaccess文件

如果您打算建议使用.htaccess解决方案,请不要回复

编辑:有人向我解释说,自2.4版以来,可以使用DirectoryMatch和美元标记语法来处理这个问题(下面的一个示例),但我一直无法使它正常工作

<DirectoryMatch "^/path/to/the$">
  Options -ExecCGI
  <Files file.php>
    Options +ExecCGI
  </Files>
</DirectoryMatch>

选项-执行CGI
选项+执行CGI

< /代码>当前运行Apache 2.2,但如果有合适的解决方案,它可能会考虑升级到2.4。这是一个相关的bug,但我在阅读之后就不太明智了。