0

I am using xampp, in Windows 7.

in my understanding, calling a script this way should run the php.exe asynchronously and not wait for the script to end.

$run_cmd = "cmd c:/xampp/php/php.exe c:/xampp/htdocs/Gashash/batch_test.php";
$oExec = $WshShell->Run($run_cmd, 0, false);

of course:

$run_cmd = "cmd c:/xampp/php/php.exe c:/xampp/htdocs/Gashash/batch_test.php";
exec($run_cmd);

the exec() option doesn't work as desired as it halts the calling process until batch_test.php ends.

I tried using '\' and '\' as well as '/' for the slashes in the path but the script doesn't work!

Any suggestions ?

Thanks!

1 Answer 1

2

Ii have answered this 3 times in the last week, please search first.

$WshShell = new COM("WScript.Shell");
$run_cmd = "cmd c:/xampp/php/php.exe c:/xampp/htdocs/Gashash/batch_test.php";
$WshShell = $WshShell->Run($run_cmd, 0, false);
Sign up to request clarification or add additional context in comments.

4 Comments

I did see your answer, but still. No go... I copied paste it right now.
what happens? as that's the 'universal' answer i have never had any problems with.
well, if I change the Run's 0 param to 1 I get the cmd line show up and immediately close. My batch_test.php script should be writing something to the log as a test. But the log is empty. If I execute the same line through cmd manually (without cmd as the beginning) it runs ok, if I add the cmd it doesn't
Something in the script was weird. I changed the log write to a COM wscript.shell calling to notepad.exe, and it executed it. Sorry for the bother

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.