E
E
Extramezz2017-03-06 21:40:44
PHP
Extramezz, 2017-03-06 21:40:44

How to increase PHP script execution time? 504 error?

There is a php parser. I run a php script by sending a request to http://site.ru/script.php. The script works for 30 seconds, then issues a 504 code and stops.
Prescribed

ini_set('max_execution_time', 999999999);

    ignore_user_abort(true);

Uselessly. How to be?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Axian Ltd., 2017-03-06
@AxianLTD

For example, php.net/manual/ru/function.set-time-limit.php.

M
Michail Wowtschuk, 2017-03-07
@wowtschuk

php.ini
max_execution_time = 120 - maximum script execution time, 120 seconds is my limit.
//Run indefinitely, will not wait for result
$e = "php /home/mysite.ru/start.php > /dev/null 2>&1 &";
exec("$e");
//Run for infinite time, will wait for result
$e = "php /home/mysite.ru/start.php";
$result = exec("$e");
Related
php.net/manual/ru/function.exec.php
php.net/manual/ru/function.shell-exec.php

V
Vasily Pupkin, 2017-03-07
@HectorPrima

I did this:
In the crown, the task is executed once a minute.
The job looks in the folder and checks for the existence of the file.
If a file has appeared (created for example by a script or by hand), then the cron deletes this file and starts the file file of your long process.

<?php
# запуск импорта
if (file_exists('www/xxx.xxx/process.sig')){
    unlink('www/xxx.xxx/process.sig');
    exec('/opt/php53/bin/php process.php');
}

process.php runs for as long as you like.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question