Forum Moderators: coopster

Message Too Old, No Replies

Remote file copying and execution time limit

         

bloogis

10:13 am on Jul 2, 2007 (gmt 0)

10+ Year Member



Hi,

I'm trying to copy a file from remote server with copy(), but this usually exceeds 30 sec time limit and I get a fatal error. I'd like to know if there's any other way to solve this than increase time limit. Maybe it is possible to launch a separate thread for this process, so that script wouldn't wait for file being copied. Any suggestions?

Thanks, Justas

phparion

10:33 am on Jul 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you can use set_time_limit(0); to avoid time outs. Also you can use exact amount of seconds in it for example set_time_limit(120); means two minutes. remember this doesn't work in safe mode.

Habtom

10:36 am on Jul 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe it is possible to launch a separate thread for this process, so that script wouldn't wait for file being copied

Yes, running it in a background could be the solution:
exec("cp -r /var/www/remotesite /var/localcopy");

phparion

6:08 am on Jul 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



do we need an Ampersand (&) sign at the end of the command to make it run in the background?

[edited by: coopster at 11:17 am (utc) on July 3, 2007]
[edit reason] Disable graphic smile faces [/edit]