PHP still won't allow file uploads larger than

2019-05-11 14:21发布

问题:

I have a Debian Squeeze install on an Amazon EC2 instance running Apache2, and PHP 5.3.3-7. I would like it to be able to accept uploads from a standard point-and-shoot camera (about 5 MB). Accordingly, I've edited php.ini in /etc/php5/apache2/ to allow for up to 18MB uploads, and I've upped the time PHP will allow to work on a script.

Despite restarting Apache and even the machine itself, it absolutely refuses to upload any file larger than 2 MB. Is this an EC2 problem or is it still a PHP issue. I'm fairly sure I've ironed out all possibility of it being PHP, but I've been staring at the same 4 lines of code for the last week and searching like a mad person for what this could possibly be.

/etc/php5/apache2/php.ini:

max_execution_time = 120
...
max_input_time = 120
...
upload_max_filesize = 18M
...
post_max_size = 18M

I have double checked just now with phpinfo(), these settings are in effect, but it still does not work.

回答1:

Check settings upload_max_filesize and post_max_size in your php.ini file



回答2:

The problem is likely to be Sohusin. The default packages from APT on debian has Sohusin built in.

This also affects your upload size limit. Take a look at this link for a fix and an explanation: http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/



回答3:

don't know if that will be of any help on your setup?

In Apache:

TimeOut

Amount of time the server will wait for certain events before failing a request

LimitRequestBody

Restricts the total size of the HTTP request body sent from the client

Also on some server setups you cant change php.inp via scipts