Cannot modify header information- Warning


#1

Warning: Cannot modify header information - headers already sent in Unknown on line 0

I am getting above warning in every post request to my app. What can be the issue?


#2

You are outputting some data before the application sends its headers.

This can be some white space you have before the <?php tag or if you are closing the the php block (?>) and have some white space at the end of the file.


#3

I have checked every file again, there is no whitespace before the <?php tag and i am not closing any php block. I am getting this warning only in $app->post.


#4

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

Got it. The error is due to this deprecated message. Thanks for help.


#5

Any other place you output anything before Slim sends the headers?

Edit; Glad you found it :slight_smile:


#6

“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”

I did all necessary changes in php.ini file but still i am getting same error