简体   繁体   中英

PHP exec() hangs when starting javaw.exe

I have a php script that I want to use to start my solr jetty server. Something like this:

chdir("C:/solr-4.4.0/solr-4.4.0/example/");
echo getcwd();
exec("javaw -jar start.jar > output.log 2>&1 &");
echo 'done';

The problem is that if javaw.exe is not already running, the php script hangs and waits for it to finish. I thought that redirecting the output and adding the & to the end would take care of this but it doesn't....

QUESTION:

Is there way to start this process (javaw.exe), let it run in the background and continue executing the rest of my php script?

(WINDOWS 7 PRO 64 BIT)

for windows:

$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("javaw -jar start.jar > output.log", 0, false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM