dongque6377 2014-12-25 09:00
浏览 94

PHP:无法使用shell_exec()启动服务器

I want to create my own little control panel for my minecraft server,

I got problems with executing commands in php.

So if I want to execute a .sh file in PHP It works, I tried to do an output with

echo "xyz"

This works, but if I try to start a server, it doesnt..

My Server-Start-File:

echo "$1 's Server is starting with $2 MB of RAM"
screen -AmdS $1 java -Xmx$2M -jar spigot1649.jar

My PHP-Script:

<?php
$x = shell_exec('./start.sh test 512');
if($x) {
echo "Started";
echo "" . shell_exec('./start.sh test 512');
} else {
echo "Failed";
}
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 为什么我按照电路图做出的仿真和实物都不能使用
    • ¥15 mars2d在vue3中的引入问题
    • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面
    • ¥15 算法题:数的划分,用记忆化DFS做WA求调
    • ¥15 chatglm-6b应用到django项目中,模型加载失败
    • ¥15 CreateBitmapFromWicBitmap内存释放问题。
    • ¥30 win c++ socket
    • ¥15 C# datagridview 栏位进度
    • ¥15 vue3页面el-table页面数据过多
    • ¥100 vue3中融入gRPC-web