By hey_germano on
I run into PHP memory limit errors on two pages in the admin area of my site - a massive menu admin page and sometimes on the admin/content/node page. I know how to increase the memory limit globally, but is it possible to somehow increase it only on certain pages?
The site gets a lot of traffic, so it wouldn't be optimal to raise the memory limit all the time since that can reduce the number of requests we can handle.
Thanks!
Comments
it IS possible!
Finally found a way to make this work. Maybe somebody else will find it useful. I added this to settings.php:
Thank you!
I had the same issue and I solved it with your snippet! I have improved it a little bit to include a couple of defines:
This example is unsafe.
This example is unsafe.
You should use a regular expression that checks that /admin/ is at the START of the string.
Otherwise attackers could use up your extra memory by making a path like /any-page/path/admin/ and sending lots of requests to exhaust your system's memory.
A better expression to use would be '!^/admin/!', such as:
Good advice!
I would advise using a delimiter such as # not ! - which although perfectly valid in your example looks like a negation rather than a delimiter.
George Boobyer
www.blue-bag.com
I agree with you. Good tip!
I agree with you. Good tip!
Old habits die hard ;-)