0

i need to make a web page (Which will of course be secured) to restart a process on my Linux machine.

I'm not much of a PHP guy, but so far I've tried about what i know (which is very minimal)

<?php
$getpid = shell_exec('pidof processineedtokill');
shell_exec('kill -9 $getpid');
?>

See the thing is, I know "kill -9 $getpid" will not work. How would i use $getpid in a " (' ') "?

Thank you!

alex416
  • 31
  • 7
  • 1
    Interpolation only works in double quoted strings. – mario May 12 '16 at 02:41
  • 1
    It may not work unless you either run your web server as the root user, or the process you're killing is running as the same user as the web server – scrowler May 12 '16 at 02:43
  • @mario Thanks! I belive this is what i need! :). I can set some permissions in sudoers to fix the issue for the webserver i believe! – alex416 May 12 '16 at 02:46

0 Answers0