I have a program that calls PHP from python, with popen, and I don't get any stdout or stderr from my calls.
The problematic lines are:
task = subprocess.Popen(
['/usr/bin/php', exec_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env
)
stdout_str, stderr_str = task.communicate()
task_result = task.returncode
When I replace the PHP path with ls, it works:
task = subprocess.Popen(
['/bin/ls', exec_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env
)
stdout_str, stderr_str = task.communicate()
task_result = task.returncode
# Works as expected
And when I run the PHP command from the shell, it does produce output.
For reference, the PHP file is:
<?
echo "YAY";
?>%