How to Increase the Memory & Upload Limit in WordPress

Fixing error messages regarding WP memory or upload limits

WordPress works straight out of the box, and for the most part, all the technical aspects that may cause errors or obstacles will be coming from the server side, which means that whenever you run into problems such as Memory Limit or File Upload Size Limit; you need to optimize your server configuration and settings to reflect proper changes. We will look at both in this quick tutorial.

Increasing Memory Limit
Image Source: Unsplash – / License: CC0 Public Domain

Increase File Upload Size Limit

First, we have the very common error on upload file size limit:

The uploaded file exceeds the upload_max_filesize directive in php.ini

This error message is quite self-explanatory in its own nature. You’re trying to upload files that are bigger in size than what is specified within the PHP.ini config file, and the one way to fix it is to adjust the config file to reflect the file size that you prefer. Each server has their PHP.ini file located in different locations, so you have to use locate php.ini on your server, or use the hosting management panel that you have from your hosting company.

Once you’re live editing PHP.ini, you can add for example the following lines of code:

upload_max_filesize = 100M
post_max_size = 200M
max_execution_time = 180

This code should take full care of any further issues with upload files that are bigger in size, and you can always change the values to reflect the size of the files that you’re going to be uploading as well. We have also heard of reports from several users that sometimes editing their PHP.ini file doesn’t actually work, and that it’s worth trying to change the values using the .htaccess file you can find in our web root directory.

Open the .htaccess file and for example add the following lines of code:

php_value upload_max_filesize 100M
php_value post_max_size 200M
php_value max_execution_time 180
php_value max_input_time 180

Either one should work, and if it doesn’t – you will have to reach out to your hosting company and talk to them about what the issue could be.

Increase your Memory Limit

The second issue we keep hearing about and know relates to File Size Upload Limit is Memory Limit; which basically means that the server is trying to complete an action that requires more allocated memory than currently has been put in place. It can be fixed just as easily. You can follow the same steps as discussed above, and add the following values:

Change in the PHP.ini file:

memory_limit = 1024M

In case that doesn’t work, add to .htaccess:

php_value memory_limit 1024M

And once again, remember that you can change those limits according to the resources available on your server. And if neither of those worked for you, the last resort would be to edit the wp-config.php file directly by adding the following line of code:

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

And this should do the trick. There is no reason for any of these not to work, unless there are strict limitations set in place by your hosting company, which is where you should be headed if your errors are still persisting. Hopefully these tips are helpful to assist you change your file upload limits and memory limits in WordPress.

Share this with your friends


  1. I’m having this message when I access theme personalize:

    Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 491520 bytes) in /home/storage/c/f6/79/mrnews/public_html/wordpress/wp-includes/media-template.php on line 1137

    How to fix it?

    • You could increase the memory limit as stated in the article or contact your hosting company for further assistance. If your website is hosted on a low-priced shared hosting environment it might be necessary to upgrade your hosting plan as well, depending on the number of plugins you’re using and the amount of resources your website needs to function properly.

  2. I have created a plugin that very easily changes the max upload size in any PHP configuration – by using chunked upload. It splits the file into smaller chunks, and that allows you to upload any filesize. Please check it out and give me any feedback or bug reports and I’ll promptly fix them: WP Awesome.

    • That’s an awesome plugin! Our clients were constantly asking how to properly increase the max upload file size in WordPress and we always recommended a tutorial on our website. We will update our tutorial and include your plugin for sure!

    • Hey, when I want to activate your WP Awesome plugin, I get the error:

      Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/x/e/xeramicnl/www/wp-content/plugins/wp-awesome/inc/Awesome.php on line 50
      • Hi Max, if you’ve found a bug or have an issue with the WP Awesome plugin (now called: “HUEM: Huge Upload Enabler, mostly”), it probably would be best to report that directly in their support forum because they’ll possibly miss your comment here.

Leave a Comment

Your email address will not be published.