PHP popen function : How to wait for process completions?
Posted: Mon Nov 23, 2009 6:00 am
Hi
I am on windows machine. I am calling two python scripts from PHP code using POPEN function.
$p1 = popen($Python_script1, 'r');
$p2 = popen($Python_script2, 'r');
Python_script1 creates new text file and writes some data into it. this text file is later accessed by Python_script2.
Python_script1 runs fine. But Python_script2 does not run at all.
Is there any way in PHP by which I can wait for 1st process to complete and file is created successfully and then run 2nd process?
SLEEP function is of no use as time taken to finish 1st process is unknown.
Regards,
Pratik
I am on windows machine. I am calling two python scripts from PHP code using POPEN function.
$p1 = popen($Python_script1, 'r');
$p2 = popen($Python_script2, 'r');
Python_script1 creates new text file and writes some data into it. this text file is later accessed by Python_script2.
Python_script1 runs fine. But Python_script2 does not run at all.
Is there any way in PHP by which I can wait for 1st process to complete and file is created successfully and then run 2nd process?
SLEEP function is of no use as time taken to finish 1st process is unknown.
Regards,
Pratik