I have created a site in laravel.
Where i use below code to get result from an external python script.
$ssh = new \phpseclib\Net\SSH2("11.111.11.11", 22);
ignore_user_abort(true);
set_time_limit(0);
$ssh->setTimeout(0);
$result = $ssh->exec("python /url_to_remote_python_file $site $keywords ", $output, $ret_code);
If i get an array back that takes arround 3 minutes to complete everything works fine.
I just found out that the problem is that the php call is hanging for a very long time, when the python script has finished its not sending anything back so the php call just hangs, how can that be?
But when i request a larger array from my python script i get a timeout with below code.
502 bad gateway nginx 1.8.0
I tried to follow the link Prevent nginx 504 Gateway timeout using PHP set_time_limit() but i am still getting 502 bad gateway when calling exsternal python script, can the exsternal server be the problem?
I whould like to make it work manualy before making it run as a cron job, whould that at all be possible.?
I have tried to put the script in laravel queue system. But there it only works if the script runs for about 3 minutes. If the script runs for, lets say 10 minutes the queue listener and log doesn't return anything back to me.
How can i call a python script from php and make sure i get a result back.
I need to run my script every night at around twelve a clock to populate my database when new results, but i need to make it work manualy first.
What is the best way to make this happen?