Welcome to WebmasterWorld Guest from 54.162.227.136

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Executing commands (linux) with PHP

     
5:45 am on Jan 18, 2005 (gmt 0)

10+ Year Member



Hi,
I'm not really sure the best way to appoach this but basically i want to be able to run game server commands in a specific linux account eg.

'screen -A -m -d -S hlds_server1 ./hlds_run -game cstrike -autoupdate +servercfgfile server1.cfg &'

I want to run this off a different liux account (not root) i tried using the search on the forum but want really sure what to search for so i didnt get very far.

Whats the best way to go about this?
can i use shell_exec() and login to my other accout and run these commands? i have tried this but couldnt figure out how to login to my other account. i would preferable like to beable to do this remotely (but atm my http server is run on the same server as the server i run my games off) so might the way to use sockets and connect through ssh port? and send the commands through that?

Could someone point me in the right direction please.

If this has been discussed before i'm sorry for repost but i couldnt find anything on the net that really made me any the wiser. If there have been previous threads relating to this subject please link me.

regards
rob

5:33 pm on Jan 18, 2005 (gmt 0)

10+ Year Member



might want to chroot and exec, check out www.php.net and for exec , there are lot of examples there
6:01 pm on Jan 18, 2005 (gmt 0)

10+ Year Member



Yeh i can see how this can be used but i am unable to find anything relating to the process of actually logining into the seperate linux account. apache is running off 'www-data' and my game servers are running from 'game-servers' presumably i could run them off the 'www-data' but is there going to be any problems with stability/security/performance or anything like that if i do so. Also i dont see how exec can be used if i am wanting to be able to do this from a seperate server.

regards
rob

 

Featured Threads

Hot Threads This Week

Hot Threads This Month