Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Using PHP to execute a shell script

Posted by: Westie Mar 4 2008, 06:19 AM

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:

    echo `gtaserver kill westie`;

where the result (as it should be) is this:
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?

Posted by: DS2K3 Mar 7 2008, 06:29 AM

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.

Powered by Invision Power Board (
© Invision Power Services (