How to get response from python to php? -


php never response if use sleep 5 minutes or more in python. using sleep around 2 minutes , working, not know happening, problem?

sample code

uploadfile_database.php:

<?php     $file_id=1;      $response=exec('python /home/xyz/test.py '.$file_id);      echo $response;  ?> 

test.py

  import os, json   import sys     sleep(300)    #sleep(420)    print "hello" 

exec not work you're expecting. output of python script need pass output parameter exec.

ex.

$output = array(); $exit_code = exec('python /home/xyz/test.py '.$file_id, &$output); 

you use shell_exec work you're expecting


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -