Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

megamitch's avatar

set 'always_populate_raw_post_data = -1' to Laravel php ini

I have this error on my AJAX request, please refer below.

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

is there a way I could touch the Laravel's php ini to set 'always_populate_raw_post_data = -1' as the warning instructed? I usually use "php artisan serve" all the time to run my app so I guess I should set the 'always_populate_raw_post_data = -1' to my Laravel's php ini. Any ideas, help will be greatly appreciated. Thanks in advance.

0 likes
1 reply
dylboy's avatar
dylboy
Best Answer
Level 3

@megamitch I am guessing you have solved this issue.

But for anyone else i hope this helps

Depending on php version i am using 5.6.25 On my mac php.ini is in /usr/local/etc/php/5.6

You could do from terminal as well if you are familiar with it. You can edit the file from here.

I believe you will need to restart apache "sudo apachectl -k restart"

then run php artisan serve again.

Please or to participate in this conversation.