0

Suddenly received error message on drupal 10 url generated by ddev - Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/twig/twig/src/Environment.php(360) : eval()'d code on line 43.

In my project's root directory inside .ddev directory created file -

mkdir -p .ddev/php
nano .ddev/php/php.ini

In the php.ini file, added the following line to increase the memory limit to, memory_limit = 6G ddev restart Created file - web/phpinfo.php Access the phpinfo.php file in my browser: http://my-ddev-site/phpinfo.php to look for the memory_limit setting but nothing reflected. error message turns to - Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/twig/twig/src/Environment.php(360) : eval()'d code on line 43

Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 65536 bytes) in /var/www/html/vendor/composer/ClassLoader.php on line 576` Please help to resolve this.

1 Answer 1

1

You have done the right thing to extend the memory_limit (as from docs).

You should be able to see the changed configuration in phpinfo(); in a php file.

However:

  1. Your computer doesn't have enough memory to provide the amount of memory you're trying to use. It seems that you have 2GB total available in your Docker environment?
  2. Most likely your PHP code is doing something wrong and using an infinite amount of memory. Note that your PHP app won't have 2GB available typically on any server, so you're going to have to fix what's actually wrong here.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.