How To Run PHP Code In The Background on unix server

后端 未结 3 758
清酒与你
清酒与你 2020-12-11 08:54

In my web site I have some feature to upload data feeds by users. These data feeds normally having more than 30,000 records. And each records need to be go through complex v

3条回答
  •  伪装坚强ぢ
    2020-12-11 09:52

    Use exec()

    http://php.net/manual/en/function.exec.php

    This will allow you to run the long process in another thread. I've used this to all other PHP, Python or C apps to convert wav to mp3, video conversion, or parsing through large XML files...

    Be sure to have it notify you or the user, probably via email, when it completes, and if it was successful.

    EDITED with working code at purehuman.info/demo ... it actually writes the file now. This is what I would make thread.php look like:

     
    

    If you are in windows:

     
    

    need to give credit for the windows part: How to execue PHP scripts in the background using EXEC() and CMD

提交回复
热议问题