【问题标题】:MAMP 3, .htaccess and php_valueMAMP 3、.htaccess 和 php_value
【发布时间】:2014-03-12 09:44:04
【问题描述】:

Hy

我已将 mamp2 更新为 3。 之后我会在 apache (2.2.5) 中得到以下错误

[Wed Mar 12 09:10:58 2014] [notice] Digest: generating secret for digest authentication ...
[Wed Mar 12 09:10:58 2014] [notice] FastCGI: process manager initialized (pid 13431)
[Wed Mar 12 09:10:58 2014] [notice] Digest: done
[Wed Mar 12 09:10:58 2014] [notice] Apache/2.2.25 (Unix) mod_wsgi/3.4 Python/2.7.5 mod_fastcgi/2.4.6 mod_ssl/2.2.25 OpenSSL/0.9.8y DAV/2 mod_perl/2.0.8 Perl/v5.18.0 configured -- resuming normal operations
[Wed Mar 12 09:11:07 2014] [alert] [client 10.241.101.148] /Applications/MAMP/htdocs/dev/application/sites/mypage/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration

阿帕奇 2.2.5 / php版本:5.3.14

htaccess

php_value   xdebug.profiler_enable_trigger  1
php_value   html_errors On
php_value   xdebug.scream 0

php_value   display_errors  on
php_value   error_reporting 1023

php_value   xdebug.max_nesting_level 150

php_value   upload_max_filesize 70M
php_value   post_max_size 75M

AddType text/x-component .htc
AddType application/vnd.ms-fontobject eot
AddType font/opentype otf
AddType font/truetype ttf
AddType application/x-font-woff woff

php_value   newrelic.appname                                "myapp.ch.dev"
php_flag    newrelic.enabled                                on
php_flag    newrelic.browser_monitoring.auto_instrument     off

一些想法?我不太适合 apache 配置。谢谢

【问题讨论】:

    标签: php apache mamp mamp-pro


    【解决方案1】:

    如果您在 CGI 模式下运行 MAMP 的 php,则 .htaccess 文件中不允许使用 php_value 和 php_flag 指令。

    假设您使用的是 MAMP Pro,请转到主 MAMP 窗口的 PHP 选项卡并确保“模式”设置为“所有主机(模块)的相同 PHP 版本”。重新启动您的 MAMP 服务器,您的 .htaccess 覆盖应该没问题。

    如果您必须在 CGI 模式下运行 PHP,您可以将覆盖直接放入您的 php.ini 文件中。

    【讨论】:

      【解决方案2】:

      如果您可以在除本地服务器之外的所有其他服务器上使用php_value,并且您真的想在CGI 模式下使用PHP(就像我的情况一样),您可以在本地使用php.ini 文件并在其中添加特殊条件您的.htaccess 文件将其保存在存储库等中,同时仍避免 500 秒。

      例如通过使用这个sn-p的代码:

      <IfModule mod_php5.c>
          php_value upload_max_filesize 200M
          php_value post_max_size 200M
      </IfModule>
      

      只有在可能的情况下才使用php_value(PHP 作为一个模块)。

      【讨论】:

        猜你喜欢
        • 2013-09-29
        • 1970-01-01
        • 2011-06-24
        • 1970-01-01
        • 1970-01-01
        • 2015-08-09
        • 2014-11-21
        • 2018-12-09
        • 1970-01-01
        相关资源
        最近更新 更多