M
M
Multigame2018-02-20 14:34:50
PHP
Multigame, 2018-02-20 14:34:50

How to read more than 16kb from a stream? What directives cut the stream?

Good afternoon.
A POST request is sent to the server, the body of which is a file (not a form with files, but the file itself).
I'm trying to get data on the server

$theStream = fopen('php://input', 'r');
      $contents = stream_get_contents($theStream);
      var_dump($contents);
      file_put_contents('/srv/www/r.txt',$contents,FILE_APPEND);
      exit();

And if the POST body is less than 16 kb, then everything is OK, it is output by the wardump, written to the file. But if it is more, then in $contents the string is zero length.
Configuration: nginx + php-fpm(7.1.10).
I feel that somewhere either in nginx or in php such a send is cut by the config .... Tell me which directives to look at?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
neol, 2018-02-20
@Multigame

Maybe client_body_temp_path in nginx is not writable?
To check, you can try adding
client_body_in_file_only clean to the config (at the same time, it seems like any post request should have an error, regardless of size)
or just look at error.log, in theory there should be abuse about this.

A
Artem, 2018-02-20
@proudmore

php.net/manual/en/ini.core.php#ini.post-max-size

W
Wexter, 2018-02-20
@Wexter

upload_max_filesize
Also look at memory_limit, it should not be less than upload_max_filesize and post_max_size

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question