Storage::copy in laravel doesnt copy a Large file Perfect

501 Views Asked by At

I'm trying to copy a 10GB file to another directory in my local disk using this code Storage::copy( 'file/test.txt', 'file2/dest.txt' );

But when I check it on the destination path it only copied 1.7GB out of 10GB. It didn't show any timeout errors at all. Is there any work around on this?

1

There are 1 best solutions below

0
On

as long as invoking php script will be happen with a request. a malicious code can turns system into an infinite loop, or an attacker (Danial of Service) can make a script run for a long time.

so to preventing this. PHP came up with some default setting which make it to not run for a long time period and exit the execution if some amount of time out passed and it didn't returned a response.

usually this times are sufficient. and its an unusual case you have to copy 10 GB file within a script run

i suppose you have a regular HDD whit speed of about 60 MB/s for a execution time of 30 seconds, it will copy about 1800 MB. and it make sense with your evidence.

Temporary fix

10000 MB / 60 MBps = 168 second. i come up with 180 second via a margin

in your php.ini , in Resource Limit Section, there are parameters for time out. uncomment them and make them 180 seconds:

max_execution_time = 180
max_input_time = 180