I need to use the PHP copy() function to copy files from one place to another. I intentionally do not use rename() .
Files ranging in size from 500 MB to 1 GB. It seems that after I launched the PHP script, it takes about 10-20 seconds (one file is processed per execution).
My server refused to download these files due to the values max_execution_time , post_max_size , upload_max_filesize and memory_limit , all of which are set ridiculously high, but the server just shuts down when I tried to download.
Now I am worried that the server will fail if this copy() operation is started when the site is dealing with a lot of traffic.
So my question is: does PHP copy() in such a way as to overload server memory and / or deadlines?
I know that a PHP script requires a lot of time, but I hope that time is, in fact, just a period of "waiting" with low memory, when PHP sits back and allows the server OS to move the file ... I would not think that PHP will need to load the file into a buffer or something like that in order to copy it, but the discussion of memory at this level is a topic that is slightly different from my understanding.
Can someone explain how PHP copy() uses memory, and are there any risks associated with memory overloads?
source share