DESIGNED DEVELOPED DELIVERED

Mob: 07760 392284edward@ee-web.co.uk

ee-web thinks... a bit

Go on, make my day ... leave a comment

Memory limit in wordpress – solving on cPanel

February 11th, 2015 by Edward

Recently whilst installing some plugins/templates for WP I came across this error whilst trying to access the wp-admin for a wordpress install.

Fatal error: Allowed memory size of 41943040 bytes exhausted ....

We are on a shared server, so changing settings directly was not going to be a solution

By creating the famous phpinfo() file I saw that the memory_limit = 32M

Sometime later…
… I hit upon this:

Create a php.ini file in the home directory and add in this line -with whatever memory_limit you want

memory_limit = 128M;

That’s good, except that it only works for the folder within which the php.ini file was sitting – we need to make it so that every folder would (as it were) carries out this command – this is called making it ‘recursive’ and is done in the .htaccess file.

Where’s my .htaccess file eh?
Now, wordpress doesn’t create the .htaccess file until you set the permalinks – something it took me a good 15 minutes of surfing around to discover. Here was a problem. I needed to get into the backend of WP but it was unavailable due to the memory limit! What to do?

You could just create an empty .htaccess file, however I solved this by going into the plugins folder and changing the name of a plugin folder until it worked – for me it was first time because we have js_composer which I suspected was causing the problem (so I renamed it js_composer-fred).

Now I had backend access, so I set the permalinks and then saw that I had the necessary .htaccess file.

Now was able to add this to the first line of the .htaccess file

suPHP_ConfigPath /pathtoserver/public_html/php.ini

Now I changed the js_composer-fred back to js_composer and hey presto – back end access.

And a great sense of relief!

I wonder if we will have problems with this down the line if we decide to make another alterations to the .htaccess file… let’s wait and see.

tag
categories

Edward owns and runs ee-web design and has been building websites for over 12 years. He is passionate about... most things really

Was this post helpful or interesting? Spread the news.

Leave a comment

*


tag