Is it wise to use PHP for a daemon?

前端 未结 17 1413
庸人自扰
庸人自扰 2020-11-28 09:18

I wish to create a background process and I have been told these are usually written in C or something of that sort. I have recently found out PHP can be used to create a da

17条回答
  •  醉梦人生
    2020-11-28 10:01

    Cron job? Yes.

    Daemon which runs forever? No.

    PHP does not have a garbage collector (or at least, last time I checked it did not). Therefore, if you create a circular reference, it NEVER gets cleaned up - at least not until the main script execution finishes. In daemon process this is approximately never.

    If they've added a GC in new versions, then yes you can.

提交回复
热议问题