How to kill a linux process using pid from php?

后端 未结 3 2000
夕颜
夕颜 2021-01-18 23:06

I am facing one issue regarding killing a Linux process from my php code. I am running a Scrapy tool from my php code using the proc_open() function in the back

相关标签:
3条回答
  • 2021-01-18 23:35

    You can use exec with sudo privileges for skill that is more safer check out kill users processes in linux with php

    Thanks & Regards,
    Alok Thaker

    0 讨论(0)
  • 2021-01-18 23:37

    Never, ever, give apache sudo permissions!

    Use exec("kill -9 $pid"); - your apache process started it, it can kill it :)

    0 讨论(0)
  • 2021-01-18 23:44

    Try posix_kill:

    bool posix_kill ( int $pid , int $sig )
    

    Send the signal sig to the process with the process identifier pid.

    0 讨论(0)
提交回复
热议问题