【发布时间】:2014-12-28 00:55:09
【问题描述】:
我最近将生产服务器升级到 Ubuntu 14.04 和 PHP 5.6,现在我的错误日志中出现警告:
2014/10/31 10:42:45 [error] 17128#0: *46238 FastCGI sent in stderr: "PHP message: PHP Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0" while reading response header from upstream, client: 24.123.216.42, server: example.com, request: "POST /api/notes HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "example.com", referrer: "https://example.com/admin/"
我read the documentation 以及这个有点相关的问题:Undefined variable: HTTP_RAW_POST_DATA。但是,我无法弄清楚为什么要记录此通知。据我所知,我没有在我的代码库中的任何地方使用$HTTP_RAW_POST_DATA。我试过了:
find . -exec grep "HTTP_RAW_POST_DATA" {} \; -print 2>/dev/null
来自我项目的根目录(包括所有供应商目录),但我没有找到任何匹配项。
我 read more about always_populate_raw_post_data 并且似乎只有在 always_populate_raw_post_data 参数设置为 TRUE 时才应填充 $HTTP_RAW_POST_DATA。我检查了我的phpinfo(),参数设置为0。
如果我没有明确调用$HTTP_RAW_POST_DATA 并且always_populate_raw_post_data 设置为0,为什么我的错误日志中会出现这些通知?将always_populate_raw_post_data 设置为-1 有什么作用?
【问题讨论】:
-
有可能是隐藏在服务器的配置文件中。
-
我想过。我跑了
find /etc/nginx -exec grep "always_populate_raw_post_data" {} \; -print 2>/dev/null没有结果。此外,它在phpinfo()中显示为0。 -
你知道这个问题,创建重现问题的最少代码。
-
顺便说一句。您不接受我的帖子作为答案是否有具体原因?我想知道未来的改进。
标签: php