Is there an easy way to increase the maximum file upload size (currently 2 megabytes)?
The file upload size is set in your PHP configuration, php.ini
, with the parameter upload_max_filesize
.
The setting can be changed in a number of different places depending on your webserver and the method it uses to run PHP.
If your Webserver allows the modification of PHP settings through a .htaccess
file (Apache + mod_php) add the following two lines to a .htaccess
in the installed directory:
php_value upload_max_filesize 15M php_value post_max_size 15M
Otherwise you need to modify your php.ini
(usually located in /etc/php5/php.ini
, but refer to your administrator or distribution manual for the correct location):
upload_max_filesize = 15M post_max_size = 15M
After modifying the global php.ini
you will need to restart the webserver to have changes take effect.
Set the following parameter to a reasonable value in your php.ini if you get „Upload Failed“ errors after setting upload_max_filesize
and post_max_size
:
memory_limit = 256M ; Maximum amount of memory a script may consume (default: 16MB)
Users with Suhosin might need to increase the suhosin.post.max_value_length
value as well.
Red Hat ES users will also want to check (and probably increase) LimitRequestBody
in /etc/httpd/conf.d/php.conf
, which is set by default to a fairly low value. This directive specifies the number of bytes from 0 (meaning unlimited) to 2147483647 (2GB) that are allowed in a request body.
An updated default FastCGI restriction, which limited the maximum body size of a HTTP request results in internal server errors. You may set new values in your apache, i.e.
<IfModule mod_fcgid.c> FcgidMaxRequestLen 26214400 FcgidConnectTimeout 60 </IfModule>
for 25 MB and 60 sec timeout.
nginx has its own limit for the maximum request size. You want to increase it by adding the appropriate value in your nginx.conf
:
client_max_body_size 25M;
If you want to disable checking by nginx, set it to 0
client_max_body_size 0;
For more details check the support section of your webhost, the documentation for your webserver and the instructions for configuring PHP at www.php.net.