WordPress Fatal error: Allowed memory size of issue and how to fix it

So I have run into this issue with some wordpress sites more often of late, I guess shared hosting servers or similar are tightening their reign on memory allocation? In any case, funnily enough, as I went to post this very post I┬áreceived┬áthe same Fatel error on TechHelp Blog!! So I had to perform my fix to gain access to tell you all how I did it! So this is really only going to work on a LAMP server and even then only on a hosting platform that allows environment variables for php.ini to at least some degree. Basically we are placing a php.ini file in our root directory and referencing it in our .htaccess file. And here’s how.

Edit your .htaccess file in the public_html folder on your website having the issue.

At the very top of the file put in the following
SetEnv PHPRC /home/username/public_html/ <- replace the address with the base address of where you are intending to put the php.ini file we are creating next. Save the file.

Create a new file in the location you assigned in the last step called php.ini ensure it has secure permissions. Please the following text in the php.ini file and save it.

memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

And that should have your issue resolved!

Questions in the comments, Cheers! :)



 

Share

Tags: , , , , , , ,

No comments yet.

Leave a Reply