Magento – Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 12288 bytes)

dockermagento2memory

I'm getting the next error after docker-compose up.

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to
allocate 12288 bytes) in
/var/www/html/vendor/zendframework/zend-modulemanager/src/ModuleManager.php

Magento ver. 2.1.7
I'm using mageinferno/magento2-php:7.0-fpm-1

Here is docker-compose code:

version: '3'
services:

phpfpm:
    build: ./.docker/phpfpm
    links:
        - database
    volumes:
        - ./:/var/www/html
    environment:
        - XDEBUG_CONFIG=remote_host=10.200.10.1
        - PHP_IDE_CONFIF=serverName=terp

nginx:
build: ./.docker/nginx
links:
– phpfpm
volumes:
– .:/var/www/html
ports:
– "8083:80"

database:
image: mysql:5.7
environment:
– MYSQL_ROOT_PASSWORD=qwerqwer
– MYSQL_DATABASE=terp
– MYSQL_USER=terp
– MYSQL_PASSWORD=qwerqwer
ports:
– "3311:3306"
volumes:
– ./mysql-data:/var/lib/mysql

What could be the reason of that?

Best Answer

I was able to solve this by adding the actual value directly inside the php.ini file and mounting my custom version of it in the container. Apparently the variable PHP_MEMORY_LIMIT is not there when running the cron.

You can see the default php.ini file here https://github.com/mageinferno/docker-magento2-php/blob/master/conf/php.ini

Related Topic