1. Support
  2. Knowledge Base
  3. Tutorial
  4. How to Increase the Memory & Upload Limit in WordPress

How to Increase the Memory & Upload Limit in WordPress

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 – Pixabay.com / 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.

Was this article helpful?

Related Articles

Stay in touch with us!

Join our newsletter and we let you know about new theme releases,
as well as important updates and discounts.