akeneo / Dockerfiles

DEPRECATED for PIM 4.0 and above - Official Dockerfiles for Akeneo development and testing
https://hub.docker.com/r/akeneo/
MIT License
49 stars 34 forks source link

PHP Fatal error: Allowed memory size #347

Closed pfazzi closed 4 years ago

pfazzi commented 4 years ago
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Affected image and tag akeneo/fpm:php-7.3

PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted occurs when i try to install some new dependencies. Why don't you increase the memory_limit in akeneo.ini?

damien-carcel commented 4 years ago

Hello @pfazzi.

This is a known behavior of composer. It can requires huge amounts of memory and fail even with 2 GB. However, 2 GB is already way too much compared to what Akeneo or any Symfony application should consume. This value is only set that high for development purpose, and should in fact be lower (like 512 MB max).

Regarding composer, the best solution is to manually set the memory, either with an environment variable or directly through the command line:

$ php -d memory_limit=3G /your/path/to/composer update
pfazzi commented 4 years ago

Thanks @damien-carcel, you're right. 3G is too much for a Symfony application. Anyway, just to allow composer run, I added in my docker-compose.override.yml (in dev machine) the following volume config:

services:      
  fpm:
    volumes:
      - ./docker/php/app_dev.ini:/etc/php/7.3/cli/conf.d/app_dev.ini

Where app_dev.ini contains the custom app confinguration for dev purpose, including memory_limit = 3G.

BTW I really like Akeneo docker containers and i'm using them in other symfony project, even based on Sylius. Great job guys!!!

damien-carcel commented 4 years ago

Great solution indeed. I'm very happy our Docker images fit your needs :-).