Reputation: 4353
I've got an application that sends relatively large POST requests to an Apache shared hosting.
On the server, there's a .php
file with
file_get_contents("php://input")
that's supposed to read the POST raw body. It works as long as the POST body is less than ~16000 characters in length. If there are more, the above piece of code returns an empty string.
I'd like to have the entire body returned, regardless of its length.
By default, it is said there's a post_max_size = 64M
setting in the server's php.ini
. Setting it myself manually doesn't alleviate the issue.
The client-side code always works properly. The Content-Length header is set correctly as well.
Sending the POST via a HTML form and accessing it with $_POST['content'] server-side behaves in the same exact way.
Upvotes: 2
Views: 1125
Reputation: 4353
The solution was to create an empty folder named tmp
in the public root.
In most cases it most likely would be created automatically (if needed at all), however this hosting company's configuration is flawed, I believe.
Upvotes: 2
Reputation: 731
Try adding this all the way on top of your script:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
You are most likely getting an error that you cannot see due to errors being disabled.
You can also try removing --with-curlwrapper
from the PHP configuration and rebuilding it.
file_get_contents returns empty string
Upvotes: 1
Reputation: 21
The problme might be with the web server. You may try to up the body limit on your web server software. For example in Apache :
LimitRequestBody
in Nginx :
client_max_body_size
Upvotes: 2