Search code examples
phpcomposer-phpwampservercontao

PHP out of memory error does not reflect memory_limit setting in php.ini


When I try to install a package to Contao using the Composer client I get an error:

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 134217728 bytes) in phar://D:/wamp/www/myproject/composer/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

I am really confused. My PHP memory limit is set at 512M. phpinfo() confirms it. But 1073741824 is a gigabyte! And it still isn't enough, as if the script totally disregards the PHP memory limit (where?) and even a gigabyte isn't enough!?!?

What can I do? I read about RLimitMEM, but I can not find such a setting anywhere on WAMPServer.


Solution

  • I found the answer.

    I searched the project for memory_limit and found out, that the composer client attempts to set a memory limit in system/modules/!composer/src/Runtime.php There is this line: @ini_set('memory_limit', '1024M'); I changed it to @ini_set('memory_limit', '2048M'); essentially doubling the available memory, and it worked.