1

I am working on a minecraft control panel in Ubuntu and thus I need to start/stop a .jar filewith shell_exec();

When I try commands like "whoami", the output is normal. But when I try this:

shell_exec("screen -dmS mcsrv java -Xmx512M -jar /var/www/srv/craftbukkit.jar -o true nogui");

It does not do anything, I have checked the permissions too and www-data is the owner of the files

1
  • btw: wouldn't it be easier to start the minecraft server like all the other services/daemons under ubuntu as described at wiki.ubuntuusers.de/Dedizierter_Minecraft-Server (in german, but google translate does an OK job there, it starts with "To improve the handling of the server...") ? Commented Mar 31, 2014 at 6:43

1 Answer 1

1

Try to redirect the standard error stream to stdout (by appending 2>&1 to the command), fetch that output and print it to check whether there was a meaningful error message

$cmd = "screen -dmS mcsrv java -Xmx512M -jar /var/www/srv/craftbukkit.jar -o true nogui";
$redirect = '2>&1';
// using variable substitution only for readability here 
shell_exec("$cmd $redirect", $output);
var_dump($output);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.