C
C
criminalist2019-04-23 14:48:07
PHP
criminalist, 2019-04-23 14:48:07

PHP problem when uploading files larger than 2GB?

Hello, I ran into a problem when uploading files over 2GB to the server using PHP and a form.
The first moment takes a very long time to load, for example, the file is loaded in 5 minutes, but after a full download it disappears from the / tmp folder and is apparently copied to the site directory, which is why this process is very long and it breaks apparently.
The logs throw errors " child 5344 exited on signal 15 (SIGTERM) after 1290.834798 seconds from start " Playing
with the settings does not really help, plus or minus in size and time, and still falls off.
In PHP.INI, the settings for the volume of downloaded files are set with a margin of 16 GB.
In NGINX,
sendfile on;
keepalive_timeout 30;
keepalive_requests 100;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
direction 10m;
reset_timedout_connection on;
client_max_body_size 6G;
client_body_buffer_size 128m;
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
I tried to create tmp in RAM (tmpfs), the situation changes radically and the files are completely uploaded to the server, but for a very long time!
What happens to the file after it is uploaded to the /tmp folder, why does php-fpm hang, how to catch and solve this problem?
If you have not provided any data, just write and I will post what is required.
I forgot to add, the sha1 hash of the file is still being calculated, although the situation has not changed.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton, 2019-04-23
@karminski

Are you uploading a file in one stream? Use file upload in parts. As an example (but not a panacea) - https://blueimp.github.io/jQuery-File-Upload/.

R
rPman, 2019-04-23
@rPman

2GB - looks like it hit the 32-bit addressing limit (i.e. file size in signed int), in php integers are converted to double when 2^31 is exceeded, with all the resulting glitches.
try the 64-bit implementation on test hardware if I'm right.

A
Alexander Kubintsev, 2019-05-06
@akubintsev

In nginx, you should try to turn off request body buffering
fastcgi_request_buffering off

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question