Hi. Is there any possibility to run some long-time task in background (some PHP function as some thread running on the server) and provide some status monitoring/control for user by refreshing page. E.g. Need to upload some big file, depending on size and connection speed, max. request time of the server can be expired. Instead, some function would run something like thread (some PHP code) which would copy the file from temporary location to some permanent location. Some page would show the status of the thread. There could be some possibility to cancel the process shown on the page. Is it possible with PHP (with J2EE apps it is). I want to avoid of max. request time expiration risk. Thanks. Ivo.
yes its possible.. thats an ajax application. if your familiar with ajax you will notice the "onreadystatus ==4 or == 200" thats where this function goes in. try to search more on the forum, i have read these from other forums here at the philippines
Ajax is another possibility of monitoring on client side instead of refreshing page. But I need that stuff on server side for long-time tasks (longer then request timeout). Because if the request is activated even by Ajax, timeout is still counting down
If you are using a shared hosting, then you cannot change max timeout as most of the hosting companies does not allow it. However, you may split the file into small equal parts and then use multiple AJAX requests to upload the files. Then after upload you can join the files. You will need a J2EE or C# application for splitting. You can join using php also.
I have used file uploading just as a sample. Generaly, there are some tasks which processing time can expire request timeout. I need upload file via post request and use some other stuff with processing including some database operations. PHP is standard offer by webhosting providers however, Java isn't. Also, there's a need to do it with thin client. Some operations are covered with Java applet with splitting files. But splitting covers only file uploading.