+2 votes
by
Made a parser in python and would like that it is called from html and display the progress of executing, done using the php function system() , but unfortunately this function displays the result only after full execution of the script, besides php ends the lifetime(

3 Answers

+2 votes
by
Take the Flask, grab Your parser take threading . In one thread stuff the parser in the other Flask. Teach them to communicate among themselves. And all the trick :-)
+1 vote
by
The easiest option to redirect the output of Python script in a file and using php to display this file in the browser. Press F5 and the updated file is displayed. You can include JS script to auto-update.

In General, I advise you not to torment PHP, and raise a simple wsgi app on Python, flask there, Yes, the same as django. In the future, to save the results of parsing in the database of this application. And then want configuralo bolted to the script with a web muzzle, or any other viewer results\logs, and will be in two languages to write.
by
Elios to run it not through system() and using exec() and terminate php script. Peronaci the script will continue to work on the server.
by
Well, OK, Python will output the log to a file, Ajax this log will display, and what to do with hanging page performs the function system("pythonscrpt.py") which eventually will go into timeout?
+1 vote
by
cool, Monsieur knows his perversions )

and what if not a secret, do not hit the run just from the command line?

with PHP if you smoke then it is AJAX that the status from the server to, but for Python it's a shame
by
User and the command line is unfortunately not compatible
...