Fatal error : Allowed Memory Size of 134217728 bytes Exhausted On Wordpress - How I Fixed it


A web page on one of my websites powered by WordPress has not been accessible for some weeks now. So yesterday, I decided to check what might be the cause. I signed in to cPanel, checked the error log and discovered that it has been throwing the php "Allowed memory size error" that reads :

"PHP Fatal error :Allowed memory size of 134217728 bytes exhausted (tried to allocate xx bytes) in /home/xxxxx/public_html/wp-includes/meta.php on line 838"

After googling the error, I discovered that it is one of the common WordPress errors, which can simply be fixed by increasing the memory limit set in the php.ini or  the wp-config.php file.

I changed the limit in wp-config.php from 128M to 512M but failed to resolve the problem.

I set  the cPanel "File Manager" to display hidden files, yet couldn't find the php.ini file. So, I contacted my host to help me increase the memory limit in the php.ini file.

Guess what?

The error was fixed after the support staff created the php.ini file for me and increased the memory limit to 512M as seen in the screenshot below :


increase memory limit in php.ini file


So, if you can't fix the error by editing the wp-config.php file, try editing the php.ini file.


NB:

1. You can check for errors via file manager, public html > error log.

2. php.ini file is located in cPanel -> File Manager -> public_html folder. If not there, ask your host to add it for you. The support staff told me that he added it to mine by adding the code below to the .htaccess file :


<IfModule mod_suphp.c> suPHP_ConfigPath /home/MycPanelUsername/public_html </IfModule>

enable php ini in web host cpanel folder


I hope this helps.








Comments