How to execute a large PHP Script?

前端 未结 7 1460
你的背包
你的背包 2020-12-24 08:16

Well basically I may want to execute a script that may take as much as 1 hours as well.

What I really want to do is Send SMS to my users using a third party API. So

7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 08:36

    IN THE CASE YOU CAN RUN CRON JOBS

    I usually have a queue, a manager and workers. Unless you can call the sms api once at the time this model can help you, and you souldn't worry about timeouts since each worker will manage it selves.

    I have something like:

     {
    // update to running
    exec("/usr/bin/php /path/to/send.php {$id} > /dev/null &");
    // }
    

    and send.php will send each sms. Right now I have this running at a rate of 300/minute since is the max frequency that you can setup on a cron job

提交回复
热议问题