【问题标题】:php_flag in .htaccess.htaccess 中的 php_flag
【发布时间】:2012-07-17 06:53:49
【问题描述】:

我运行一个 apache-server,我只需要一个 php_flag 就可以不同于虚拟主机中的全局配置。

我在那个虚拟主机目录中没有 .htaccess 文件,所以我只是添加了它包含

php_flag flagname On

我的 httpd.conf 包含

<Directory "/path/to/host">
AllowOverride All
</Directory>

我使用标准服务器 API,而不是 suPHP 或其他任何东西

无论如何,phpinfo 一直告诉我,我设置为 On 的标志仍然是 Off。 标志是 suhosin.simulation,应该可以在 .htaccess 中设置。

我错过了什么?

【问题讨论】:

  • 哪个标志?您不能覆盖 .htaccess 中的任何 php 设置。
  • php_flag 在 php 作为 apache 模块运行时生效。你呢?
  • 我知道这看起来很明显,但是您尝试过重新启动 Apache 吗?我注意到 .htaccess 中设置的 php_flag/php_values 在 Apache 重新启动之前无效。
  • 我确实重启了 apache。此外,如果我在那个 .htaccess 文件中犯了明显的错误,它会给我错误,所以它正在被读取。
  • PHP 是作为 Apache 模块还是 FCGI 加载的?当 PHP 是 Apache 模块而不是 FCGI 时,这些指令仅在 .htaccess 中有效。

标签: php apache .htaccess


【解决方案1】:

php_flag 只能设置 PHP_INI_ALLPHP_INI_PERDIR 类型指令。您可能需要在 vhost 配置中的 &lt;Directory xxxxxxxxxx&gt; &lt;/Directory&gt; 范围内使用 php_admin_flag。您需要重新启动 Apache 才能锁定它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-01
    • 2015-05-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多