在php中使用shell_exec()时无法从python脚本中获取结果

I need to get the result of python script run in terminal and it be used in php so i had tried with shell_exec, exec, passthru, system. Now the problem was the python script take more time to generate the result(upto 45 secs) so it would be returned empty result. if i am used sample python script(just print one array) it working fine with those php functions(shell_exec,exec,system,passthru). What i do for myself to resolve the problem.

Thanks in advance.