Drupal php fatal error allowed memory size

Views — PHP error: Allow memory size exhausted [closed]

I’m suddenly experiencing the infamous «PHP Fatal Error: Allowed memory size of XYZ bytes exhausted» (Drupal 7.38) This happened while trying to save changes to a view: I simply wanted to modify the field display order, nothing more, nothing less. So, at the moment I can’t see my website, even as an anonymous user, and even pages that aren’t related to the view. Moreover, I can’t access the admin panel. I know this problem is usually related to module activation or other major changes, but in this case it is only a «minor change», related to an already existing view, a very simple one (and I have others — more complex), so even if I could increase the PHP memory limit, I think this would be only a workaround and not a «real» solution.

Ok, I restored the db dump and the website now is working. But everytime I try to modify a view (e.g. simply for changing its description) or I try to insert a new one, when saving I get the PHP error again in file database.inc. The only solution is importing the dump again, since simply truncating the cache* tables doesn’t help at all. Increasing the php memory limit doesn’t help too: I tried to it set to 256mb, then to 512mb and I still get the message. The site has been online for several months and I modified the views a lot of time in the past without any problem. I’m stuck!

Читайте также:  Styling html links with css

Ok. I found that the problem was the Boost module! If I disable it I can modifiy the view normally! So: disable Boost -> edit/save view -> enable Boost

Источник

Fatal error: Allowed memory size [Решено]

При попытке редактировать тип материала /admin/structure/types/manage/ получаю страницу вот такого вида:

Как видно, на странице выводится ошибка: Fatal error: Allowed memory size of 157286400 bytes exhausted (tried to allocate 17154162 bytes) in /var/www/lotro-mindon/includes/database/database.inc on line 2168

Не могу понять где нужно увеличить память. Менялось в php.ini, settings.php, устанавливалось на сервере, но все равно ошибка остается.

Подскажите, пожалуйста, что я делаю не так?

Комментарии

Память увеличивается в php.ini
memory limit редактируй для увелечение памяти.
Ставь минимум 256. Проверить можно через phpinfo();
там пишется, сколько памяти выделено.
Если ошибка остается, то смотри что делал до ошибки и отменяй изменения.

а сколько памяти выставлялось?

Сейчас в php.ini установлено: memory_limit = 512M

phpinfo() тоже отображает 512M

Друпал был обновлен до версии 7.24.

Идея одна — у вас не хватает памяти.
Причину мы не знаем

iHappy, в смысле? Чего именно не хватает для полноты информации?

Увеличение памяти проблему не решает( Есть ли еще какие-то возможности узнать какой модуль дает сбой/отжирает память?

Всмысле, имея ту информацию, что ты дал, никто не скажет в чем причина. Кроме бабушки Ванги.
Но она тут не тусит.

Увеличение памяти проблему не решает( Есть ли еще какие-то возможности узнать какой модуль дает сбой/отжирает память?

Вообщем, проблема оказалась в модуле Automatic Nodetitles. Совместно с Node references и Entity Tokens на странице редактирования типа материала создавалась очень большая и тяжелая таблица с токенами.

Эта проблема обсуждается на странице модуля:

Для меня самым легким решением было просто отключить Automatic Nodetitles. Возможно, есть другое решение.

Спасибо за внимание, всем добра

https://drupal.org/project/auto_entitylabel
This module grew out of the Automatic node titles module and aims to be a full replacement.

У меня такая же проблема. Установил Drupal 9.3.0 и шаблон danland-8.x-1.1.
Добавил только одну страницу, никаких модулей не устанавливал. При попытке зайти в раздел «содержимое» появлялась эта ошибка, я увеличил память до 4536M и при загрузке страницы http://drupal/admin/content появляется сообщение

Fatal error: Allowed memory size of 4756340736 bytes exhausted (tried to allocate 10644508388 bytes) in C:\OpenServer\domains\drupal\core\modules\views\views.module on line 512

На остальные разделы захожу без проблем.

Сайт установлен на Open Server 5.4.0, PHP 7.4.21

Источник

White screen of death: Fatal error: Allowed memory size of X bytes exhausted

Basically all the confirmation pages redirect me to a white screen. When I refresh it again, it shows me the page. I tried to increase the PHP memory value but it doesn’t help.

Are there any other solutions for this?

The error which I’m having:

Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 8192 bytes) in sites/all/modules/views/plugins/views_plugin_localization_none.inc on line 1

Always check the error logs, it will have all the info needed. Sounds like in your case you are running out of Memory. Drupal 7 requires more than 32MB which many of host providers set it as a default.

6 Answers 6

I know this may be late, but it helped me. Most times a module causes WSOD, I couldn’t just disable modules to test which it was, since I may have lost data in the process. What I did was to temporarily edit this function in module.inc , in the core includes directory

function module_invoke_all($hook) < $args = func_get_args(); // Remove $hook from the arguments. unset($args[0]); $return = array(); foreach (module_implements($hook) as $module) < print "Starting loading $module 
"; $function = $module . '_' . $hook; if (function_exists($function)) < $result = call_user_func_array($function, $args); if (isset($result) && is_array($result)) < $return = array_merge_recursive($return, $result); >elseif (isset($result)) < $return[] = $result; >> print "Finished loading $module
"; > return $return; >

And I added those 2 print statements in the code above, then refresh the page, the module which didn’t reach the «Finish loading $module» statement is the one with the problem. it was devel in my case.

After finding the module, you can go into the system table and look for that module, set it’s status = 0 and bootstrap = 0 or run the query:

UPDATE system SET status = 0, bootstrap = 0 WHERE name = 'module_name' LIMIT 1 

Adding the print statements to module_invoke_all allowed me to quickly find the offending module. Then I used drush to disable it. What a life-saver!

You’re welcome @DanMeigs. I have used this method only today to fix my blog cleverlogic.net. Maybe I do should write an article on this, cuz I sure did read a lot whiles trying to get the WSOD fixed

Paste this code in your index.php file. It will show you the error message instead of blank page. At least the root of the problem can be known. Paste it right after php tag.

 error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); 

Hope it will show you the way!.

Have you checked your error log? If you’re running Apache on Linux, try this command in the terminal: tail /var/log/apache2/error.log . That will show you the 10 most recent lines of that file.

Actually, it started showing me the errors.. The error I get is Fatal error: Allowed memory size of 100663296 bytes exhausted (tried to allocate 8192 bytes) in ***/sites/all/modules/views/plugins/views_plugin_localization_none.inc on line 1

Adding this to index.php is a bad idea (even temporary, as most people are to lazy to remove it later on if this works), it’s better to paste it straight into your settings file.

Reason of blank white screen of death is the error reporting turned off, to check the error add the following lines in your setting.php file:

error_reporting(E_ALL); $conf['error_level'] = 2; ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); 

For the error you are facing(«Allowed memory size of XXX bytes exhausted»), you can try the following things:

  1. Truncate the cache manually and check if it fixes the problem ( It is probably be a good to backup your DB before doing that): Access phpMyAdmin and truncate all tables starting by cache_ from the database .
  2. Increase the memory limit (as the main reason of the above error is the memory exhausted by the server which caused the partial loading of the modules and that is causing the problem) by adding the following line in your settings.php file: ini_set(‘memory_limit’, ‘-1’);
    Adding ini_set(‘memory_limit’, ‘-1’); overrides the default PHP memory limit.
    If you want to restrict the memory than instead of -1 you can provide memory size like ‘256M’ OR ‘512M’.

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)

To convert bytes X into MB, divide by 1024*1024 or check at Wolfram.

happens when PHP tries to allocate Y bytes, but there is hard limit on X bytes set by PHP memory_limit configuration settings.

The current limit can be checked by going to Administration » Reports » Status report » PHP (URL: /admin/reports/status/php ) or by printing ini_get(‘memory_limit’) in PHP (note that limit be different for UI and CLI).

In order to fix it, you need to lower your resource usage, for example:

  • disable any development modules which you’re not using currently (recommended), This includes: Devel, Devel Themer (if enabled).
  • disable any modules which you’re not using,
  • disable certain debug variables which can impact on your memory resources, e.g. few examples with drush :
drush -y vset rules_debug 0 drush -y vset rules_debug_log 0 

If you decide on increasing memory limit, a lot of people here advising to actually hack your core by pasting the PHP code into your index.php to increase your PHP memory — never do that! It’s a very bad practise.

Instead edit your settings.php (or settings.local.php if you have it included) and paste the following code there at the end:

or a better way of doing this is to edit your PHP config file ( php.ini ) and changing the following line:

memory_limit = 512M ; Maximum amount of memory a script may consume 

If you’re not sure where is your php.ini , check by:

To investigate further which pages/components are using the most memory, you’ve the following possibilities:

For further information, check:

  • Drupal System requirements and PHP requirements at Drupal.org
  • Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) at Drupal.org
  • Increase PHP memory limit at Drupal.org
  • Increase memory limit doesn’t help at DA.SE
  • for drush , check: Memory Exhausted with Drush at DA.SE

Источник

Ошибка Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 45 bytes)

че делать теперь? вообще на сайт не заходит(((((( блин.

Лучший ответ

Впишите в settings.php следующее ini_set(‘memory_limit’, ‘-1’); ))) должно помочь))

Комментарии

Ошибка «Allowed memory size of X bytes exhausted (tried to allocate Y bytes)» — говорит о том что вашему скрипту не хватает памяти, точнее скрипт не укладывается в тот обьем памяти который разрешен для выполнения PHP скриптами. Это как вариант, а вообще может быть много причин

открываю фаил php.ini что тут мне искать? какие строки? я просто не сильно понимаю

memory_limit =
Как вариант

Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 4104 bytes) in X:\home\localhost\www\456\includes\menu.inc on line 637

Мало добавили, он ещё хочет

я поставил 1256м он пишет то же самое, а это вообще какая память используется оперативная? или какая?

а как то эту базу данных почистить можно?

Возможно проблема в том, что скрипт читает какой-то файл, а этот файл оказывается слишком большой.

вы наверное забыли перегрузить апач после того, как отредактировали php.ini — изменения не вступили в силу

я перезагружаю сервер локальный, уже поставил 25000 м всеравно пишет мало, есть какие то другие варианты.

Поставьте голый Drupal и попробуйте активировать тот модуль на котором ошибку выдавало.

А вообще я уже не помню когда последний раз ставил друпал без подобных ошибок, как правило разницы в работе модулей не увидел.

Впишите в settings.php следующее ini_set(‘memory_limit’, ‘-1’); ))) должно помочь))

мне помогло в .htaccess прописать php_value memory_limit 250M

Дантес, спасибо, мне помогло!

DanTeS, вот это спасибо, вот это выручили)

Всегда рад помочь, если конечно это не шутка))

Работает уcтановления значения memory_limit= -1 в php.ini и соответсвенно рестарт апача.

Источник

Оцените статью