Answer the question
In order to leave comments, you need to log in
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);
Answer the question
In order to leave comments, you need to log in
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
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');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question