I intend to write N-queens solution to a file in PHP. As the time elapsed for large N is so long, I want to place PHP code on the server, and then request for that page. Is it possible that when I close the tab in the browser, the server keep calculating and write to a file to fulfil my request ? Then later on I would check the file to see the results. If not possible, any suggestions for this problem is appreciated.
Share
You can use a combination of ignore_user_abort and set_time_limit:
Rather than an infinite time limit, you could estimate the number of seconds the script will need and pad more time on to it. That way the script won’t have a chance to hang the process.