I’ve tried different variations of this, increasing the memory limit, and so on… and it still works intermittently. Images are uploaded/copied successfully for only so many iterations, then the script starts over again completely - not just the loop. I’m not sure whats triggering this “start over”.
Maybe I need to put in a delay after every file_get_contents. I’ll try that.
Please… for the love of god… - what is causing this? :(
Update 1: Okay, its time-based, because setting a 5 second sleep at the end of each iteration reduces the number of files I’m able to upload before the PHP starts over. Something must be causing some sort of a timeout… I think.
Update 2: I omitted all superfluous code, and tried executing the PHP with just the bare necessities - just to see if it was something else conflicting with my file copy loop, and I was able to copy 160 files before the PHP “started over”. Better from 40, but the point is - it still does it. Basically, I can tell because $count keeps going back to 0.
I love spending 3 days on one simple problem like this - makes me love being a web developer!
Update 3: It loops, file_get_contents, apparently for no longer than 69 seconds.
Why can’t I have normal problems? You know… the kind that have solutions.