On This Post, You Will Learn How To Resolve PHP Memory Limit Error In WordPress
One of the most common errors in WordPress is the PHP memory limit error. It happens when WordPress does not have enough memory to process a command.
It is mostly caused by poorly written plugins that run a procedure until the installation is out of its memory.
Since WordPress memory consumption will increase with the number of modifications, it means that the more plugins you install and activate, the more memory your WordPress website will needs.
Therefore it is advisable to know your hosting memory allowance.
You can contact your host to get the host PHP memory limit information.
Alternatively, for WordPress users, you can install and activate this free WordPress plugin called “WP-ServerInfo.” The plugin will add a new dashboard widget that will display the allocated memory.
For instance, see the image below (image source wordpress.org)
After determining the initial value, add both lines below in your “wp-config.php” file to increase the Memory Limit.
define( 'WP_MEMORY_LIMIT', '256M' ); define( 'WP_MAX_MEMORY_LIMIT', '384M' );
Whatever value you decide to use is up to you, but note that WordPress memory can be different regardless of your server’s memory settings. Do not change so much; try to stay below 512MB.
Then check the WP-ServerInfo Widget to see if all is OK. In case if it still displays the same value, then you have to edit your “.htaccess” file by adding the line below to it
php_value memory_limit 256M
Also, note that this will be needless if they are overwritten in the php.ini. Therefore you must also check your php.ini. The php.ini file can only be made available by your host provider. It is not editable from WordPress.
If you can’t find the php.ini file, you will have to contact your hosting provider. And If your host does not allow the memory of more than 96M, then you will need to consider changing your host provider.
But If you have access to the php.ini file in your control, change the line, if the line shows 64M try changing it to 128M.
Note: Remember to always back up your WordPress site before attempting any of this.