Task not killing with exec() and posix_kill() in Ubuntu Server?

Viewed 265

I'm setting a dashbord for manage a game server but I can not kill process with PID. I tried exec("kill $PID") exec("kill".$PID) posix_kill($PID, 15) but it did not work.

A posix_kill command give a "Operation not permitted" error yet the user apache is www-data and the user for the minecraft script is www-data also.

<?php
include('pidminecraft.php') ;
$output = shell_exec("bash /srv/scripts/pidphp.sh $PID ");
if ( $output == "run" )
    { exec('kill'. $PID); shell_exec("bash /srv/minecraft/minecraft_survie/start.sh >> /srv/web/minecraft/minecraft.txt 2>&1"); }
else
    { exec("bash /srv/minecraft/minecraft_survie/start.sh >> /srv/web/minecraft/minecraft.txt 2>&1"); }
?>
0 Answers
Related