404 Tech Support

Not enough memory for PHP or just a stupid script?

I recently came across an error with a theme on Drupal 7 that was complaining about insufficient memory in order for a setting change to be made. It gave the error:

There is not enough memory available to PHP to change this theme’s color scheme. You need at least 18.51 MB more. Check the PHP documentation for more information.

Ok, that’s fair enough. I can reconfigure the setting in the Apache configuration or with a php.ini file. It’s odd that nothing else has complained about not having enough memory and changing the color scheme doesn’t seem like it should be that intense. I tossed a phpinfo() page up on the server to see what the memory limit was and I found memory_limit to be set for -1, in other words, no limit.

The script that was running must have been doing a dumb check and was seeing whether the value for memory_limit was literally greater than a specified number, perhaps 19.51MB. Since it was -1, it was failing the test. I switched the number in the Apache configuration to 256MB (seen above) and the script was able to execute just fine. I could switch it back to -1 but if any future changes need to be made, I’ll have to switch it again unless a future update fixes the issue.