Automatically populating $HTTP_RAW_POST_DATA is deprecated

重新搭建了一个PHP运行环境,发现运行项目时报如下错误:

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

查找原因后,发现错误原因如下:
官方在PHP5.6就把$HTTP_RAW_POST_DATA废弃了,而且在PHP7中把它移除了。因为这个参数影响性能,所以要废弃掉,官方建议用php://input来代替。

解决办法:
修改php.ini

always_populate_raw_post_data = -1

你可能感兴趣的:(Automatically populating $HTTP_RAW_POST_DATA is deprecated)