Ways to Increase Max File Upload Size and Execution TIme

Since I originally posted this, I have assisted several persons with this problem.  One additional thing I have found that will sometimes work is to contact the hosting service support.  A good support group can easily fix this for you.

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.

19 Responses to Ways to Increase Max File Upload Size and Execution TIme

  • Steve Reyes says:

    Joe on July 8, 2015 gave the clue needed. In the WHM > PHP Configuration Editor I was able to set both the post_max_size and upload_max_filesize to 100M
    Everywhere I looked there were different solutions, but this finally worked. THANK YOU!!!

  • saiful says:

    Cheers!!! bro …. Working nicely!!!

  • Sajan says:

    It is working fine for me. I have applied changes in functions.php and found working without any issue.

  • Joe says:

    IT WORKED!!!

    upload_max_filesize = 1000m
    ; Maximum size of POST data that PHP will accept.
    post_max_size = 1000M
    max_execution_time = 3000

    I was using Bluehost VPS and I had to login to my WHM control panel to change access to PHP Config.
    One key step before creating php.ini and php5.ini files! Fantastic solution! Thanks!!

  • Edi Santoso says:

    This is super awesome; I experienced the same things. Tried all those previous approaches, nothing worked. Finally came across this site, it just worked like a charm. Why no guide or manual about this on WordPress official site?

    Thanks Mac

  • xfreespiritx says:

    I put 1000 for large videos and this worked a treat, thank you so much!!!

    upload_max_filesize = 1000m
    ; Maximum size of POST data that PHP will accept.
    post_max_size = 1000M
    max_execution_time = 500

  • Scott says:

    if anyone is still having issues after trying these this might help…..
    To fix the “HTTP” error that appeared, set this within your .htaccess file: SetEnv MAGICK_THREAD_LIMIT 1

  • Yuvraj Khavad says:

    I try all solution those you listed but not works…..
    can server configuration effect WordPress images uploading ..? In My case in local here is 600MB but at live server it is 8MB Limit.

    if Any one have a solution then let me know…

  • Marcelo S. says:

    Your code worked for me. On my case I am using Cpanel and godaddy support suggest me to create a .user.ini and place on the public_html folder. He told me that if I tried to use the php.ini I would see problems on my system. I hope this tip help other people.

  • Eric Burnett says:

    Awesome, thank you so much! It worked for me.

  • Thierry says:


    Thanks ! The third solution wordked for me.

  • Sid says:

    I will also add my thanks. Clean WP install, about ready to go live … and then I notice this horrid “allowed memory size of 33554432 bytes exhausted … SimplePie … blah blah…” I tried everything all the other sides suggested, even WordPress.org. It didn’t get fixed until I used your last suggestion. Cheers.

  • Marcelo says:

    Thank you sooo much!!! I was going nuts trying to fix this. All the best!!

  • Anthony says:

    Finally!! Thank you so much!!! I had the exact same trial and no luck. Final option did it.

  • Selena says:

    Your method work great!
    Thank you for sharing it.

  • Jackson says:

    The last one did it for me too.

    Thanks a lot!

  • Moriganna says:

    The last one worked! Thank you so much!

  • Made says:

    Thank you so much !! I tried so many things to get this thing working ! AND IT WORKED !

  • Danielle says:

    I have been googling all day long and tried everything! This finally- did work! Thank you!

Leave a Reply

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