lucaswxp
lucaswxp

Reputation: 2119

Large php file upload

heys guys.

So... I have a website that needs to upload files like, 500MB large.

My question is... what kind of system requirements do I need? Specifically about memory. For uploading a 500MB file I need 500MB RAM? How much RAM will be necessary for ONE upload of that kind succeed?

Upvotes: 1

Views: 1704

Answers (1)

hek2mgl
hek2mgl

Reputation: 157967

PHP, or better the web server, will not buffer the whole upload in RAM.

Upload size depends not directly on RAM size. I cannot say what exactly your system should look like but I can say that I handled GB sized updates years ago with low cost work station.

Note that you'll have to change the following php.ini settings if you want to support big uploads:

upload_max_filesize = '500M';

post_max_size = '500M';

About memory again: Note that not PHP will consume the memory. The web server will handle the download. You won't worry about this in PHP.

If you use a Linux system you can view the tcp buffer size when typing

cat /proc/sys/net/ipv4/tcp_rmem

in terminal. You'll see 3 numbers. The minimum, medium and maximum buffer size in bytes. On my system it is:

4096    87380   4115680

Meaning that the maximum buffer size is ~3.9MB which is significantly smaller then the 500MB you have.

So don't worry about memory in this case. Its is very likely that the network is the bottleneck.

Upvotes: 1

Related Questions