Jump to content

Problem with running exe / *.sh file on web hosting


jianwei87

Recommended Posts

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

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;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.