performance - How to exceed max_execution_time in PHP -
in php, want run script need 2 minutes compute max_execution_time 30 seconds.
i can't change max_execution_time in php.ini nor call shell_exec
i done optimization think of. idea?
the "best" option have cut algorithm smaller part. each part should execute within 30 second avoid timeout. here few ideas.
using curl:
- [script start] call run.php let compute 20s.
- save stat database id
- make curl call run.php?resumeid=384 [script finish]
- [script start] retrieve stat , continue computation
- and on...
using cron task:
- call run.php every second. pick task in database flag "in progress". next time run.php call not pick "in progress task"
- after 20s of computation, save stat of script in database , change "in progress" flag false.
- next call run.php pick task , continue processing
- and on...
Comments
Post a Comment