Jump to content

using timers / reporting on server progress?


Chat

Recommended Posts

hi, i have a problem - my sites do some complicated stuff like resizing and copying files... and the browser always crashes when running such heavy-task scripts. but the server always gets the job done - it just takes a minute or two... so i want to be able to communicate with my website users and say that it's half done / all done...etc

 

so is there any way i can set a timer within php to check if all relevant files have been made, after 20 seconds of starting the script... and then can i report back to the website user this information?

 

dan

 

 

Link to comment
Share on other sites

Since PHP is a server side script you won't be able to have any kind of progress bar. If it takes a while you could up the timeout setting in the php.ini file so the script will run in it's entirety. And just echo a simple message saying the script is running please wait, and at the end use a META tag to redirect the person to a page which states the script has completed. You would not be able to use a header for the redirect because you would be sending information to the browser saying the script is running so you would get an error.

 

Ray

Link to comment
Share on other sites

thanks for the tip ray

 

the problem is not that my script doesn't complete itself - it does all the necessary work, but the browser seems to stop listening and waiting for the script to echo it's last bits. althought the browser also doesn't stop "loading" so presumably it's still listening. the script still finishes all jobs tho.... it's only the final echoing back to the browser that doesn't work. the copying of files and stuff before and after all echos work fine.

 

any further advice please... will be much appreciated

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.