在php.ini中将'always_populate_raw_post_data'设置为-1后,$ HTTP_RAW_POST_DATA警告仍显示在POST响应中

So i am using PHP 5.6 and building a Laravel 5.1 API and also building an android app.

When i try sending a post request from the android emulator i get the following message along with the proper data/response:

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
Warning: Cannot modify header information - headers already sent in Unknown on line 0.

I know why the error is showing up, but i cant seem to fix it.

The normal fix would be to set always_populate_raw_post_data to -1 but that is not working.

I am thinking of upgrading to a later version of php where $HTTP_RAW_POST_DATA has been removed.

any help/advice would be appreciated.

Upgrading to php 7.0 fixed it at as expected, i really wanted to avoid upgrading, but it seems that is the only fix in my case as just setting 'always_populate_raw_post_data' to '-1' in php 5.6 did not work for me.

If you are still getting the warning (as I was) run:

<?php phpinfo() ?>

and look for the value of Loaded Configuration File key.

In my case the php.ini used by WAMP was located in:

C:\wamp64\bin\apache\apache2.4.23\bin\php.ini

(symlink to C:\wamp64\bin\php\php5.6.25\phpForApache.ini)

Edit this file and set always_populate_raw_post_data = -1, then restart your server.