In any case if you want to create a large dummy file in your server for any testing purpose, use the below code to generate in instantly.

For this just create a dummy php file in your server, for eg. dummy-create.php. Then add the following content to it.

$f = fopen('dummy-file', 'wb');
fseek($f, 2 * 1000 * 1000 * 1000, SEEK_SET);
fwrite($f, 'after 2 GB');
fclose($f);

Now run the newly created php file in your browser. eg :
http://yourdomain.com/dummy-create.php

Now a new dummy file named dummy-file with provided size will be created in the same folder of your server. Here 2GB file will be created since the size here described as “2 * 1000 * 1000 * 1000” which is 2GB.

Categorized in:

PHP,