doumindang2416 2011-09-04 20:53
浏览 102
已采纳

执行php脚本(Windows)

some days ago I have published this thread, and it was solved succesfully on Unix.
Now I moved to Windows and I have the same problem. I need to execute a command from the web applicacion. It must execute a .jar stored in the system. I looked in Google and found some changes that I needed to do.

The function to execute the command is:

<?php
if($_POST["name"] == "")
    echo "name is empty";
else{
    $path = $_POST["name"];
    //$command = 'DISPLAY=:0 java -jar '.$path'; -> Used in Unix
    //$command = 'java -jar ../../../../simulaciones/tanqueCalentamiento.jar';
        $command = 'java -jar ..\..\..\..\simulaciones\tanqueCalentamiento.jar';
    //system($command);
    exec($command);
}
?>

The comments are different options I have tryed. $path is the argument, but decided to put directly the path, to claarify my question.

Do I need a kind of "trick" as I didd for Unix?? Thaanks in advance

  • 写回答

3条回答 默认 最新

  • dougu2036 2011-09-05 21:08
    关注

    In windows vista, 7 (I don't know if in others too), there is a problemm with xampp.

    The apache does not stop, doesn't matter what you do, even switch the computer off. At least for me, the solution was:

    1. Uninstall xamp and reinistall it.
    2. Start/stop it always as administrator:

      path\xampp\xampp_start
      path\xampp\xampp_stop

    Right click: run as administrator.

    In this way apache is finished properly, and I can run my command with no probleems anymore

    I hope this helps http://drupal.org/node/224342

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

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决