E
E
Evgeny Ivanov2018-09-24 11:52:38
PHP
Evgeny Ivanov, 2018-09-24 11:52:38

How to increase the execution time of a PHP-FPM nginx script (debian 9)?

I am using debian 9, PHP-FPM, MySql, phpmyadmin.

I need to import a db file via phpmyadmin .
In phpmyadmin writes Maximum size: 1,000MB (I made changes to the config)
Maximum rights.

What I did:

Increase the script execution time

nano /etc/php/7.0/fpm/php.ini
max_execution_time = 300
max_input_time = 600
memory_limit = 512M


And here
nano /etc/php/7.0/fpm/pool.d/www.conf
request_terminate_timeout = 300


And here
nano /etc/nginx/nginx.conf
добавим в секцию http {
fastcgi_read_timeout 300;


restart
service nginx restart
systemctl restart php7.0-fpm


What happens
When importing a small file (10MB) - everything is fine. And in the browser, at the bottom I see the download%.
The file is small - loading% quickly reaches 100% and everything is ok. Import successful.

But when importing a large file, the download (% in the line at the bottom of the browser) is slower, reaches 40% (for example) and resets to zero after about 30 seconds. And again 1%..2%. Then it resets again and an error occurs - the page with the error text
Cannot access the site
The web page at http://***/import.php may be temporarily unavailable or permanently moved to a new address. ERR_CONNECTION_ABORTED

In my opinion, it's a matter of script execution time.
How to increase the execution time of a PHP-FPM nginx script (debian 9)?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2018-09-24
@inoise

Do you have the ability to import data via the command line? mysql -u username -p password -h host db_name < dump.sql
Or normal software like MySQL Workbench.

R
Radjah, 2018-09-25
@Radjah

It is better to import large dumps directly through the database client (mysql or remotely HeidiSQL, for example).
phpmyadmin in this regard is an extremely slow tool and is suitable for loading the schema in order to prepare an empty database for use by the software.

A
Ainur Valiev, 2018-09-24
@vaajnur

is this a 504 error? check the logs.
Google the ERR_CONNECTION_ABORTED error - it looks like something from Windows and all sorts of antiviruses.
and also increase the timeout of the database server
[mysqld]
connect_timeout=100

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question