Blog Single Page

Ways to Increase Max File Upload Size and Execution TIme

By on 31 January 2014

Ways to Increase Max File Upload Size and Execution TIme

Here is a list of things that I tried on a couple of my sites to increase the file upload size and the script execution time.

Initial File Upload Size: 2M

Initial Execution Time: 30 sec

The first thing I tried was adding some lines to functions.php.

Note: you must be careful when editing functions.php because any mistakes will cause your site to become unusable and you must use ftp to correct the error.

// Increase max upload file size and execution time
@ini_set( 'upload_max_size' , '20M' );
@ini_set( 'post_max_size', '20M');
@ini_set( 'max_execution_time', '300' );

This did not work.

Next, I tried an addition to wp-config.php.

define('WP_MEMORY_LIMIT', '20M');

Did not work.

I found several reports that adding the following to .htaccess would work:

php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value memory_limit 20M
php_value max_execution_time 300

I don’t know if I added the lines incorrectly or not, but it caused internal server errors.

Finally, I created two files, php.ini and php5.ini, with the following lines
and added both files to the wp-admin folder. WORKED!!

upload_max_filesize = 20M
; Maximum size of POST data that PHP will accept.
post_max_size = 20M
max_execution_time = 300

If none of these things work for you, your hosting service support team might increase the limits for you.

0 Replies to “Ways to Increase Max File Upload Size and Execution TIme”

Leave a Reply

Your email address will not be published. Required fields are marked *

three + 1 =