Drupal needs higher PHP memory limit. How to increase it?

4758 viewsDrupaldrupal-7 php-memory-limit

I run a Drupal 7 website with your Economy hosting plan, which comes with only 512MB or RAM. For this reason, I have to keep my PHP Memory Limit to a minimum – which is set up to 128MB.
Some pages need higher PHP Memory Limit – for example when I save a page or a View, I often get a PHP Fatal Error that the memory limit has exhausted. I know that I can easily increase the global PHP Memory Limit, but is this the right way of approaching my problem? What would you recoomend?



We have this question asked on many occasions and this article outlines how to change the PHP memory limit based on the URL:

How to change PHP memory limit in Drupal conditionally

What you need is to follow the instructions in that article and set the URI defined via the $admin_paths variable, that need a higher PHP memory limit.

We recommend to try not to increase it dramatically, try increasing it to 256MB and see if that resolve the problem. If not, attempt increasing it in 64MB increments.

Write your answer.