Anuj Bhatt
2008-07-23 03:09:16 UTC
Hi,
I'm new to PHP and just installed apache2 with php support. I'm trying
to execute a Python script (from within php), which does take a good
amount of time and am waiting for it to terminate so that I can process
the output and print that out in HTML.
The problem I'm having is that I can't get the PHP script to wait for
the Python file to terminate. If I try it with a simple Python script
say "print Hello, World!" it gets that. But anything that takes
substantially long time, it just returns. I've tried system("myfile.py",
$result) and $result results in a 1 and prints any subsequent prints in
the PHP file. I also tried exec, with no luck. I've read through
http://www.php.net/function.exec and the documentation presented in the
"See Also" section with other commands. I haven't got anywhere yet,
after much work. Any pointers, suggestions and fixes?
-anuj
I'm new to PHP and just installed apache2 with php support. I'm trying
to execute a Python script (from within php), which does take a good
amount of time and am waiting for it to terminate so that I can process
the output and print that out in HTML.
The problem I'm having is that I can't get the PHP script to wait for
the Python file to terminate. If I try it with a simple Python script
say "print Hello, World!" it gets that. But anything that takes
substantially long time, it just returns. I've tried system("myfile.py",
$result) and $result results in a 1 and prints any subsequent prints in
the PHP file. I also tried exec, with no luck. I've read through
http://www.php.net/function.exec and the documentation presented in the
"See Also" section with other commands. I haven't got anywhere yet,
after much work. Any pointers, suggestions and fixes?
-anuj