php://input is empty on POST request

Problems with multipart/form-data forced me to parse POST request's parameters manually as I already doing for PUT requests. For that purpose I used this code:

$rawData = file_get_contents('php://input');

But I figured that php://input is always empty for POSTs, at least, for php-fpm SAPI.

Here is some pics from debugger. POST request:

PUT with same params:

Is there a way to get raw POST request body? Thanks in advance.


Before PHP 5.4 $HTTP_RAW_POST_DATA is not available with enctype="multipart/form-data" (with the exception of some SAPI implementations), explanations here:

I suggest you give a look to a couple of answers to existing questions:

From PHP 5.4+ you can use the php.ini directive enable_post_data_reading to disable PHP consuming the raw data (hence process it), be aware that $_POST and $_FILES won't be populated though (refer to Vitaly Chirkov answer).

Could you try



=== Edit - this will not show the raw post data for 'multipart/form-data'

Need Your Help

Not Submitting to database, with php, mysqli

php html database mysqli prepared-statement

I can not figure out why it is breaking after passing validation and not submitting to database. Just comes up with blank screen. I have echoed out the new_password and it is encrypting it properly...

grunt-msdeploy for deploying AngularJS app to multiple servers

angularjs gruntjs msdeploy

I am using grunt-msdeploy for deploying angularJs code to one of the server, this is working perfectly fine. I would like to deploy the same code to multiple servers. How do i achieve it ? Please h...