Running a PHP script completely on server side

后端 未结 5 1812
眼角桃花
眼角桃花 2021-02-10 21:12

I\'m having a problem where putty gets regularly disconnected. So, when I run a PHP script from the terminal, it always gets interrupted. The script is supposed to run several h

5条回答
  •  醉梦人生
    2021-02-10 22:16

    You don't need to leave it run in a cron job - you can just run the php script inside a screen.

    Simply type;

    screen php /path/to/myphpscript.php
    

    A screen will continue running even after you disconnect from PuTTY. If you need to check up on it, you can use;

    screen -r
    

    To re-attach yourself to this process, and view any output.

提交回复
热议问题