I am working on an algorithm in python for a problem which take multiple hours to finish. I want to accept some details using html/php from user and then use those to run the algorithms in python. Even when the user closes the browser, I want the python script to be running at the server side and when user logins again, and then it displays the result. Is this possible using apache server and php? Can server created using nodejs be solution? Plz help. Any help would be appreciated.
Write your processing code as a completely independent software not tied to web server at all.
Web server application will only add tasks into some database and return immediately. Your process will run as a service, polling database for new tasks, executing them and pushing some in-progress updates and final results back to the database. Web server application could see that the processing started, display in-progress and final results only looking up the database, which is fast.
Running python script on the apache server end