nginx php value,Nginx 设置 PHP_VALUE 的灵异问题

之前通过Apache里设置auto_prepend_file / auto_append_file 来实现记录页面执行时间,后来切换到Nginx后就没有设置这个了。

搜索一番,Nginx同样支持这种设置的。

配置如下:fastcgi_param PHP_VALUE "auto_prepend_file=prepend.php";

fastcgi_param PHP_VALUE "auto_append_file=append.php";

配置好后,重新Nginx,查看phpinfo()的输出,发现有时候auto_prepend_file设置为空,如图。

[caption id="attachment_1204" align="alignnone" width="300"]76332d191b39e3a2f2bdcef0880ab314.png nginx[/caption]

搜索一番后,发现Nginx不支持多条PHP_VALUE的设置。Quick little post on a problem I had while trying to use XHGui with my Nginx/PHP-FPM setup. I needed to be able to pass the auto_prepend_file and auto_append_file settings to PHP-FPM from Nginx. In apache you can declare multiple php_value settings. However, when I did the same in nginx, it would only reflect the second setting. Turns out you need to set all of your php_value’s in Nginx in a single string, and you separate them by new line characters.

如果有多条,需要将PHP_VALUE的设置合并到一条记录上,以" \n "进行分隔。

重新配置,如下:fastcgi_param PHP_VALUE "auto_prepend_file=prepend.php \n auto_append_file=append.php";

重启Nginx,查看phpinfo(),配置生效了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值