
Unfortunately, when I try to log in to one of my WordPress websites, there is an error inside the wp-admin page Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 56383 bytes) in /custom.php on line 125. Or you may find a similar error most of the time, Don’t worry all are WordPress Memory Limit errors.
WordPress Memory Limit & Max Memory Limit
First, open your root directory of WordPress find the “wp-config.php” file, and open the file in your editor. Then add the following lines inside the main PHP tag:
define('WP_MEMORY_LIMIT', '256M'); define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
We increased the memory limit to 256MB and Maximum memory limit to 512MB.
If you don’t want to change your wp-config.php file then you can choose the second option also.
For that, you need to update your php.ini file which is also located in the root directory of WordPress (If not exist then simply create a php.ini file using FTP).
Now add the following line of code within your php.ini file.
memory_limit = 256M
These both would increase the memory limit to 256 MB.
If you still get the error after these solutions, then please contact your hosting provider.
Note: If you have other solutions for increasing the memory limit, then let us know in the comments below.
Leave a Comment