Most of the small-budget shared hosting servers have a meager and limited amount of memory allocated to PHP which can cause a white screen of death or other types of the errors on your site.
By default, WordPress will attempt to increase memory allocated to PHP to 40MB (code is at the beginning of /wp-includes/default-constants.php
) for single site and 64MB for multisite, so the setting in wp-config.php
should reflect something higher than 40MB or 64MB depending on your setup.
To adjust on your own, follow the steps below:
- Access your website’s root folder via FTP or SFTP.
- Locate the
wp-config.php
file. - Open this file in any text editor.
- Add one of the lines below to the top, before the line that says:
That's all, stop editing! Happy publishing.
Increase to 64MB
define( 'WP_MEMORY_LIMIT', '64M' );
Increase to 96MB
define( 'WP_MEMORY_LIMIT', '96M' );
Increase to 256MB
Administration tasks require much memory than usual operation. When in the administration area, the memory can be increased or decreased from the WP_MEMORY_LIMIT
by defining WP_MAX_MEMORY_LIMIT
.
define( 'WP_MEMORY_LIMIT', '256M' );
Edit PHP.ini
file
If you have access to your PHP.ini
file, change the line in the file that line shows 64M try 256M:
memory_limit = 256M ; Maximum amount of memory a script may consume (64MB)
Edit .htaccess
file
In case, you don’t have access to PHP.ini
file try adding this to an .htaccess
file instead:
On a very few hosts, like GoDaddy, Hostgator and 1&1 basic plan, you may encounter issues as demo content import failure, empty page content, Customizer settings not being saved, incomplete page rendering, etc which are caused by the fact that the basic plan of these service providers are not meet the minimum server requirements to work with a modern WordPress theme.
Note that many hosts set the PHP limit at 8MB.
The modifications mentioned above may not work if your host does not allow for increasing the PHP memory limit. You may need to search your admin panel, or if you do not feel comfortable in trying the above methods, you need to talk to your hosting support and asking them to increase your memory limit.
Last updated: 3 years ago