There was a problem loading the comments.

How to Increase the WordPress PHP Memory Limit and Upload Size

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Quick answer: Raise WordPress limits in two places: add WP_MEMORY_LIMIT to wp-config.php for PHP memory, and increase upload_max_filesize, post_max_size, and memory_limit in php.ini (via cPanel MultiPHP INI Editor or Plesk PHP Settings). Keep post_max_size equal to or larger than upload_max_filesize.

WordPress errors like "Allowed memory size exhausted" or a failure to upload larger images usually mean two separate limits need raising: the PHP memory limit and the upload/post size. Here is how to lift both.

1. Raise the WordPress memory limit

Add these lines to wp-config.php, just above the line that says "That's all, stop editing":

define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

WP_MEMORY_LIMIT covers the front end; WP_MAX_MEMORY_LIMIT covers heavier admin tasks like imports. If the server caps PHP below these values, the next step is required too.

2. Increase the PHP upload and post size

These control how large a file you can upload. The cleanest place to set them depends on your stack:

# php.ini
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 120

post_max_size must be equal to or larger than upload_max_filesize, or uploads fail silently. On cPanel use the MultiPHP INI Editor; on Plesk use PHP Settings for the domain - both edit these values through a UI.

3. If you cannot edit php.ini

On some shared setups you can use a .user.ini file in the site root with the same directives, or an .htaccess entry on Apache:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 256M

4. Confirm the new limits

In WordPress go to Tools > Site Health > Info > Server and check the reported memory limit and max upload size. If they did not change, the value is being overridden at a higher level and your host needs to apply it.

Frequently asked questions

Why do uploads still fail after raising memory?
You also need to raise upload_max_filesize and post_max_size, which control file size separately from memory.

How do I confirm the new limits?
Tools, Site Health, Info, Server shows the active memory limit and max upload size.

On a SoftSys managed WordPress hosting plan these limits are set generously for real-world sites, and we will raise them further on request rather than making you hunt through config files.


Share via
Did you find this article useful?  

Related Articles

Tags

© Softsys Hosting