homepage Welcome to WebmasterWorld Guest from 54.226.43.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Executing commands (linux) with PHP
xrob




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

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

 

listerine




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

might want to chroot and exec, check out www.php.net and for exec , there are lot of examples there

xrob




msg:1302830
 6:01 pm on Jan 18, 2005 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved