DRUPAL: Fatal error: Allowed memory size error when editing specific existing pages

梦想的初衷 提交于 2019-12-10 18:08:28

问题


Fatal error: Allowed memory size of 18874368 bytes exhausted (tried to allocate 1481725 bytes) in __/public_html/includes/database.inc on line 224

I'm having this error occur in Drupal 6 every time I try to edit the following pages:

  • http://chipkin.com/fs-8700-125-stulz
  • http://chipkin.com/fs-8700-47-dnp-30
  • http://chipkin.com/fs8700-14-ge-mark-iv-speedtronic
  • http://chipkin.com/fs8700-74-veeder-root-serial-driver

We're on shared hosting so I don't have access to the php.ini file to allocate more memory, however I'm pretty sure that's not what's causing the problem.


回答1:


I am on a shared host as well. Here is the PHP.INI that I created in one of the Drupal domain root folders:

[PHP]
memory_limit = 40M;
upload_max_filesize = 20M;
post_max_size 20M;
max_execution_time = 200;
max_input_time = 200;

I have no more problems with any global limits. I am not sure if the hoster can disable or override the local PHP.ini - mine does not, and it should be worth a try.




回答2:


Definitely a memory problem -- it's going to be tough for you to run a Drupal site on only 18 megabytes of memory.

Your long term solution is to change hosts -- there are plenty of hosts that allow you to adjust php.ini (within limits). Bluehost.com is one example.

A possible short-term solution would be to remove unused modules from your modules directory. Each module eats up a little bit of memory even if it's disabled.

Things like caching and disabling statistics are good too, but they won't help much if you're getting memory problems on basic page edits.




回答3:


You can specify the memory limit through .htaccess

Try adding the following line to the .htaccess file in your site's root directory:

php_value memory_limit 32M



回答4:


I'm not that familiar with Drupal, but is the page in question trying to grab a large amount of data from the database? Something like a SELECT * for an entire table? That may explain why one call is trying to allocate so much memory.

Changing hosts is an option, but for now it may be worth seeing if something can be done to limit the data requested from the database.

Unfortunately the error message doesn't to much to tell you what specific request is causing the problem - since the code making the db request is in the db library class. If you can do any kind of stack trace, it would help.




回答5:


edit settings.php (usually in sites/default) and add (or modify):

ini_set('memory_limit', '96M');

...or however you need.



来源:https://stackoverflow.com/questions/1732867/drupal-fatal-error-allowed-memory-size-error-when-editing-specific-existing-pa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!