Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
734 views
in Technique[技术] by (71.8m points)

post - Uploading a file larger than 2GB using PHP

I'm trying to upload a file larger than 2GB to a local PHP 5.3.4 server. I've set the following server variables:

memory_limit = -1
post_max_size = 9G
upload_max_filesize = 5G

However, in the error_log I found:

PHP Warning: POST Content-Length of 2120909412 bytes exceeds the limit of 1073741824 bytes in Unknown on line 0

Can anyone tell me why this keeps failing please?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had a similar problem, but my config was:

post_max_size = 1.8G
upload_max_filesize = 1.8G

and yet I could not upload a 1.2GB file. The error was very same:

PHP Warning:  POST Content-Length of 1347484420 bytes exceeds the limit of 1073741824 bytes in Unknown on line 0

I spent a day wondering where the heck was this "limit of 1073741824" coming from!

Solution:

Actually, the error was in the php.ini parser: It only understands INTEGER numbers, so essentially it was parsing 1.8G as 1G !!

Changing the value to e.g. 1800M fixed it.

Pls ensure to restart the apache server with the below command service apache2 restart


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...