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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.