1.Edit your wp-config.php file
Since it contains your basic configuration information, wp-config.php memory is one of the most popular WordPress files. It’s in the root directory of your wp file system.
WordPress Minimum Memory:
define('WP_MEMORY_LIMIT', '40M');
Increase the value of the second parameter. As previously stated, a PHP memory limit of ‘wp_memory_limit, 128M’ should be sufficient.
define('WP_MEMORY_LIMIT', '128M');
2.Edit your PHP.ini file
If changing the wp-config.php file doesn’t solve the problem, you’ll have to deal with the problem in your server settings.
You won’t be able to access your PHP.ini file if you’re using shared hosting. If you do have access to PHP.ini. It’s most likely in the root folder, but the file’s location varies by the host.
Here’s what you need to do:
Locate or find your php.ini file. If you can’t find it, simply build your php.ini file and save it in the WordPress installation’s root directory.
Use your favorite editor to open and edit your php.ini file.
Look for the line that says ‘memory limit = 32M’.
Change the 32M or some other number to the desired limit (e.g. 256M or 512M).
Restart your localhost or server after saving your changes.
Note: If you’ve made your own php.ini file, you’ll need to add the following line to it:
memory_limit = 256M (or 512M)
In certain instances, as you progress down the list from line one to line three, the values you add can grow larger. The ‘memory limit’ should be the biggest, while the ‘upload max filesize’ should be the lowest. And the ‘post max size’ should be the median.
Clear your browser’s cookies before checking if the error has disappeared.
3.Edit your .htaccess file
If you don’t have access to PHP.ini, you’ll have to edit your .htaccess file as a last resort. Since it is a secret file, the .htaccess file begins w
ith a mark. Check to see if your SFTP file manager is keeping some files hidden from view if you don’t see them in your root folder.
Here are the details you need to add to your .htaccess file to increase the WordPress memory limit:
php_value memory_limit 256M
php_value upload_max_filesize 12M
php_value post_max_size 13M