D
D
Dmitry2016-05-25 17:06:57
PHP
Dmitry, 2016-05-25 17:06:57

How does the relationship between Nginx, php-fpm and php.ini work?

Hello. There is an Nginx + php-fpm server.
The following limits are specified in php.ini:

upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 30
max_input_time = 60
memory_limit = -1

In nginx config -
client_max_body_size 1G;
client_header_timeout 1m;
client_body_timeout 1m;
send_timeout 1m;

Before the memory_limit change, the script constantly fell off, preventing a large file from being loaded, even when the memory limit was 500mb, the 40mb file did not allow loading.
I understand that php-fpm uses php.ini. Used to load XMLHttpRequest.
In reality, I can upload files up to 1GB in 20 minutes. Phpmyadmin, in turn, shows a 100MB limit for database imports. It turns out that the post_max_size parameter does not work or does it work selectively? How does this whole relationship happen? Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2016-05-25
Protko @Fesor

Used to load XMLHttpRequest.

XmlHTTPRequest is part of the browser API, PHP does not know anything about it and does not distinguish it from other HTTP requests (the default header can be removed). That is, remove the difference between ajax and normal requests in your view.
nginx проксирует HTTP запрос на php-fpm. Вот и все. Он с ним больше ничего не делает и настройки ограничивающие что можно орабатывать у него свои.
То есть мы грузим файл в 1 гиг, тело запроса буферизуется (по умолчанию, можно отключить директивой fastcgi_request_buffering но тогда свои ограничения, хотя думаю вам оно не особо важно) и потом прокидывается в пых, где тот смотрим что тело запроса слишком большое (больше сотни мегабайт) и грустит.

N
nikolayvaganov, 2016-05-28
@nikolayvaganov

закиньте на сервер <?php phpinfo(); ?> и посмотрите, какие конфиги пхп подгружаются.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question