开发者

Using shell_exec()

I was wondering if anyone knew how I could use shell_exec() properly. I have enabled it in the php.ini file but it doesn't seem to work.

Do I have to log into the shell 开发者_如何学Cusing a username and password?

How would I access something that is on screen -r through shell_exec()?

P.S. I'm trying to run the list command on a Minecraft Server and return the data.


No you don't need to log into the shell, the shell will execute as the OS user executing your php commands. To begin, first test that you have shell_exec working properly:

<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>


You cannot use shell_exec with interactive commands. Since you are using screen simply enable the screen log and use file functions to read the screenlog.0 file created in the folder from where the screen was started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜