我正在尝试使用php在后台运行一个java程序。我可以运行程序,但页面直到java程序执行完成后才加载。
我可以使用php在后台运行shell脚本。但是如果我对java发出同样的命令,它就不会在后台运行。
$command = "java hello";
$outputfile = "out1";
$pidfile = "out2";
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $command, $outputfile, $pidfile));我如何在后台运行这个程序?
发布于 2011-10-20 04:32:28
我将此代码与以下代码配合使用:
shell_exec('java app.jar > /dev/null &');
exit();具体地说,我试图通过TeamCity构建步骤中的脚本启动两个独立的进程。
https://stackoverflow.com/questions/4057121
复制相似问题