down123321123 2012-11-23 03:22
浏览 80
已采纳

通过PHP Exec()或类似函数启动Minecraft_Server.jar

I'm trying to build a script that starts minecraft_server.jar (location: user directory / mineserver / minecraft_server.jar ).

I have PHP and Apache installed, and I'm trying trying to start the server JAR from /var/www/html/interface.php.

Via console, the server starts fine by running:

java -Xmx1024M -Xms1024M -jar mineserver/minecraft_server.jar nogui

... from the user directory. So in the interface.php file I have the following (note location listed above):

system('java -Xmx1024M -Xms1024M -jar /home/ec2-user/mineserver/minecraft_server.jar nogui', $retval);

But the server never starts after I visit the file. What am I doing wrong?

Thanks for any and all clues.

I want to say thank you for your help on Thanksgiving. While I haven't found the solution yet, I appreciate the efforts. Thanks again.

  • 写回答

2条回答 默认 最新

  • dqqt31923 2012-11-23 03:31
    关注

    Have you checked the error log? It's at /var/log/httpd by default. If anything went wrong, it should be there. Otherwise, it could be starting wrong and I would recommend launching it in a screen so you can hop in and check on anything it's doing.

    Install screen through whatever method your distribution uses, and then change the launch string to be:
    screen -dmS "minecraft" java -Xmx1024M -Xms1024M -jar /home/ec2-user/mineserver/minecraft_server.jar nogui

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本