0

I would like to use PHP to kill a process initiated by a LaunchDaemon.

I have my script, I'm grabbing and storing the pid - using getmypid() - using a table, and then referring back to that to kill the process, but I'm stuck because:

exec('sudo kill 12345');

won't work.

Is it possible to use sudo in php exec? Are there any other ways to kill a process using PHP that doesn't use the proc funcctions, or would proc_terminate and proc_open be something I should look into?

I have seen this - there is no answer so maybe it is not possible: here

Community
  • 1
  • 1
dmgig
  • 4,400
  • 5
  • 36
  • 47
  • Good question, next question. – hakre May 05 '14 at 18:58
  • what is that supposed to mean. – dmgig May 05 '14 at 19:01
  • That information is missing to answer your question if it's hopeless (which AFAIK is not a programming question) http://stackoverflow.com/questions/how-to-ask – hakre May 05 '14 at 19:02
  • Have you seen existing material like [*How to call shell script from php that requires SUDO?*](http://stackoverflow.com/q/3166123/367456) we have on site? – hakre May 05 '14 at 19:11
  • No. I searched and searched and didn't see that one. Thank you! This is all much more helpful than your first comment. Thanks guy. – dmgig May 05 '14 at 19:16
  • Writing "Is it possible to use sudo in php exec?" was much more helpful to find that other question than the hopeless sentence :) – hakre May 05 '14 at 19:21

0 Answers0