Raise the PHP memory limit and upload size
Page builders, the Customizer, and demo imports need more PHP resources than a basic blog. Low server limits show up as errors or blank screens, not as a clear message about the limit.
Recognize the symptoms
Section titled “Recognize the symptoms”- A white screen when you save in the Customizer, Elementor, or WPBakery.
- An error such as “Allowed memory size of 134217728 bytes exhausted”.
- “The uploaded file exceeds the upload_max_filesize directive in php.ini.”
- The theme ZIP upload fails or stops with “The link you followed has expired.”
- A demo import stops halfway.
Check the current values
Section titled “Check the current values”Open Tools → Site Health → Info. Expand Server to see PHP memory limit, Upload max filesize, PHP post max size, and PHP time limit. Expand WordPress Constants to see WP_MEMORY_LIMIT.
Recommended values
Section titled “Recommended values”| Setting | Value |
|---|---|
WP_MEMORY_LIMIT | 256M |
upload_max_filesize | 64M |
post_max_size | 64M or higher |
max_execution_time | 300 |
post_max_size must be at least as large as upload_max_filesize.
Raise the limits
Section titled “Raise the limits”Take a backup and change one file at a time. A typo in these files can take the site down until you undo it.
-
wp-config.php: add this line above
/* That's all, stop editing! */:define( 'WP_MEMORY_LIMIT', '256M' );WordPress cannot go above the server’s own PHP
memory_limit. If Site Health still shows the old value, the server limit is lower. -
php.ini or .user.ini: many hosts read a
.user.inifile in the site’s root folder. Add:memory_limit = 256Mupload_max_filesize = 64Mpost_max_size = 64Mmax_execution_time = 300Changes in
.user.inican take a few minutes to apply. -
.htaccess: only on Apache servers that run PHP as a module. Use
php_value upload_max_filesize 64Mand similar lines. On other setups this causes a 500 error, so remove the lines if the site breaks. -
Hosting control panel: most hosts offer a PHP settings or “PHP options” screen. This is the safest route when it exists.
Reload Site Health → Info to confirm the new values.
When to ask your host
Section titled “When to ask your host”Contact your host when the values do not change, when you cannot edit these files, or when you are on managed hosting that controls PHP settings. Tell them the values above and the exact error you see. If the limits are already high and the problem continues, ask them to check the PHP error log.
For media files that are too large, see image upload size limit.