I've made an ftp script which works great. I've set ob_implicit_flush to true so the 'files copied' list updates in real-time. The only proably is, when the script hits a large file which takes over a minute to process, the browser stops loading the page (firefox says 'Done').
I know what would fix this, but i don't know how to do it. Is there are way to make php send some kind of packet every 30 minutes to tell the browser that stuff is still happening? As far as I'm aware though, it's not possible for php to do two things at once.
There are two things you could do.
1) You could actually have your PHP script start a background process to do the FTP'ing information and then just periodically check up on the background process to see where it is at. Is it finished?, still running?, etc.
2) You can alter the max execution time of your script in the php.ini file, but again, the user may stop the execution of the browser or the browser may quit on you as well.
As for #1, you can do this in a variety of ways, with or without AJAX (depending on comfort level). Ideally, you will create a shell script or a php script to run as a system command that takes parameters or reads a file of data. Your PHP script would then use the system() or exec() placing a '&' at the end of the command to have it run in the background.
The script it kicks off would then write a log out on the system for your client script to read and output to the user, until the process is finished (this is where Ajax or just an automated refresh interval would play in).