I am connecting to a server through PHP SSH and then using exec to run a python program on that server. 
If I connect to that server through putty and execute the same command through command line, I get result like:

Evaluating....
Connecting....
Retrieving data....
1) Statement 1
2) Statement 2
.
.
.
N) Statement N

Python program is written by somebody else...
When I connect through SSH php, I can execute $ssh->exec("ls") and get the full results as proper as on server command line. But when I try $ssh->exec("python myscript.py -s statement 0 0 0"); I couldn't  get the full results but I get a random line as an ouput.
In general, if somebody had experienced the same issue and solved, please let me know.
Thanks
Perhaps it's caused by buffering of the output. Try adding the -u option to your Python command - this forces stdout, stdin and stderr to be unbuffered.
PHP exec command is not returning full data from Python script