Jump to content

php execute


sle09

Recommended Posts

ok this is a complex question

 

over all im trying to execute this command through a php file

 

when i type "cd /server && ./samp" on the command line i get "Started Server on port: 8082, with maxplayers: 32 lanmode is OFF." which is perfect, i test and yup the game server is running

 

now i made a file called start.php and it contains:

 

<?php

$cmd = 'cd /server && ./samp &';

echo "<pre>".shell_exec($cmd)."</pre>";

?>

 

 

when i go to start.php in browser is says "Started Server on port: 8082, with maxplayers: 32 lanmode is OFF." same thing as when i run in it the command line, but when i check to see if its really running, its not. ive also tried:

 

<?php

echo exec('cd /server && ./samp &');

?>

 

with the same failure

 

please help

 

Link to comment
https://forums.phpfreaks.com/topic/117678-php-execute/
Share on other sites

What happens if, from the command line, after typing "cd /server && ./samp", you type control-d? Does that kill the process? I assume that shell_exec and exec both send an eof (control-d) after the command? Now it appears you already noted this because I see you have a background operator at the end of your php commands. So a better question might be, what happens when you type "cd /server && ./samp &" from the command line? Does the process continue to run in the background? Also, have you tried:

 

echo exec('/server/samp &');

Link to comment
https://forums.phpfreaks.com/topic/117678-php-execute/#findComment-605325
Share on other sites

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.