jianwei87 Posted March 4, 2008 Share Posted March 4, 2008 i have upload my script file to my web hosting. and now i need to run my script. in side the script the have include exe, *.sh file. may i know how to going to write the php code to let my script running on my web hosting. below this are my exe and *.sh file name : char-server.sh char-server.exe map-server.sh map-server.exe map-server.sh map-server.exe how to write the code and let my script run. thank you Link to comment https://forums.phpfreaks.com/topic/94302-problem-with-running-exe-sh-file-on-web-hosting/ Share on other sites More sharing options...
wildteen88 Posted March 4, 2008 Share Posted March 4, 2008 To execute a command/program installed on the server via a PHP script you'll need to look into the following exec functions. Link to comment https://forums.phpfreaks.com/topic/94302-problem-with-running-exe-sh-file-on-web-hosting/#findComment-483031 Share on other sites More sharing options...
jianwei87 Posted March 4, 2008 Author Share Posted March 4, 2008 To execute a command/program installed on the server via a PHP script you'll need to look into the following exec functions. actually i'm know nothing on php. and can u help me to write the php code. pls pls Link to comment https://forums.phpfreaks.com/topic/94302-problem-with-running-exe-sh-file-on-web-hosting/#findComment-483045 Share on other sites More sharing options...
jianwei87 Posted March 4, 2008 Author Share Posted March 4, 2008 now i get the code and can let me know which part i should change or help me to change . <?php $script_start = './script.sh start'; $script_stop = './script.sh stop'; switch(strtolower(trim($_GET['cmd']))){ case 'start': $cnsl = shell_exec($script_start); echo('Trying to start the server...<br />'); if(!empty($cnsl)) echo($cnsl.'<br />'); echo('< <a href="./'.basename($_SERVER['SCRIPT_FILENAME']).'">Back</a>'); break; case 'stop': $cnsl = shell_exec($script_stop); echo('Trying to stop the server...<br />'); if(!empty($cnsl)) echo($cnsl.'<br />'); echo('< <a href="./'.basename($_SERVER['SCRIPT_FILENAME']).'">Back</a>'); break; default: echo('> <a href="./'.basename($_SERVER['SCRIPT_FILENAME']).'?cmd=start">Start</a><br />'); echo('> <a href="./'.basename($_SERVER['SCRIPT_FILENAME']).'?cmd=stop">Stop</a>'); break; } ?> Link to comment https://forums.phpfreaks.com/topic/94302-problem-with-running-exe-sh-file-on-web-hosting/#findComment-483075 Share on other sites More sharing options...
jianwei87 Posted March 5, 2008 Author Share Posted March 5, 2008 how to write the code to let my script running on webspcae. pls help me :'( :'( :'( Link to comment https://forums.phpfreaks.com/topic/94302-problem-with-running-exe-sh-file-on-web-hosting/#findComment-483633 Share on other sites More sharing options...
wildteen88 Posted March 5, 2008 Share Posted March 5, 2008 Not all hosts will allow to run system commands via the various exec functions what is the purpose of script.sh Link to comment https://forums.phpfreaks.com/topic/94302-problem-with-running-exe-sh-file-on-web-hosting/#findComment-484105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.