Help - Search - Members - Calendar
Full Version: Using PHP to execute a shell script
Linuxhelp > Support > Programming in Linux
Westie
I'm in the process of making a game control panel for my game-server, and part of that is making a PHP script that can kill process ID's. (Yup... I am aware of the risks.)

I'm using this code as a basis:
CODE
<?php
    echo `gtaserver kill westie`;
?>


where the result (as it should be) is this:
CODE
Server for westie has been shut down. (PID: 9340)


There seems to be a wee problem. If I use the gtaserver in PuTTY, it would kill the game-server, but if I try in PHP, it won't kill it. Nice.

I had a check with exec('whoami') and the user/group for apache is nobody.

So how would I go about getting this to work/giving apache the permission to use this?
DS2K3
You could create a different user to run Apache under, then give that user necessary permissions. I think I added my Apache user to the list of sudoers (no password required) so that it cold access certain log files - You could try something similar.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.