问题
I'm trying to use a html file input tag to upload videos to a php 5.3.10 script running on a wamp 2.2 server. I found that it won't upload and apparently it is too big.
I have gone into php.ini and changed the following to 100M: post_max_size, upload_max_filesize
and memory_limit is at 128 MB. I restarted WAMP and tried to upload the file, but it still did not upload. I then cleared my cache and history and restarted wamp, and it still didn't work. I then cleared the cache, turned off wamp, turned off my computer and then started up again, started wamp, and it still didn't work.
The video I am trying to upload is about 25 MB.
Inspite of the changes I made in php.ini, the Apache Error Log keeps posting this error, everytime I try to upload this video:
[error] [client 127.0.0.1] PHP Warning: POST Content-Length of 26246222 bytes exceeds the limit of 8388608 bytes in Unknown on line 0, referer: http://localhost/uploadFile.html
Also a php script with the following line:
echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size'), ", ", ini_get('memory_limit'): prints out: 100M, 8M, 128M
So it seems that it is the post_max_size that is the problem, eventhough I set to 100M in php.ini
What could be the problem? How do I solve this?...
Here is a link to the contents of my php.ini file, which is under C:\wamp\bin\php\php5.3.10:
http://pastebin.com/RUVE093u
回答1:
Try these settings in C:\wamp\bin\apache\apache2.2.x\bin\php.ini
Find:
post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
Change to:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
Then restart wamp.
回答2:
8,388,608 bytes = 8 megabytes
Search php.ini for multiple occurances of post_max_size. The last one is the one that's going to take effect.
Then check your website's/script-folder's .htaccess files, as they can override php.ini settings with their own values.
来源:https://stackoverflow.com/questions/10453735/trying-to-upload-video-file-in-php-but-its-too-large