My Mautic version is: Docker image 5.2.4-apache
My PHP version is: 8.1.32
My Database type and version is: Mysql 8.0
Hello,
I know it has been posted many times in the forum, and I went through all the threads and solutions I could find, but nothing has fixed the issue. Where does the value 134217728/128M come from? Is there any other memory config I can change?
These errors are showing in the log:
mautic-cron | [08-May-2025 15:08:03 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 47745808 bytes) in /var/www/html/vendor/symfony/messenger/Transport/Serialization/PhpSerializer.php on line 42
mautic-cron |
mautic-cron | Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 47745808 bytes) in /var/www/html/vendor/symfony/messenger/Transport/Serialization/PhpSerializer.php on line 42
mautic-cron |
mautic-cron | In PhpSerializer.php line 42:
mautic-cron |
mautic-cron | Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate
mautic-cron | 47745808 bytes)
mautic-cron |
mautic-cron |
mautic-cron | mautic:campaigns:trigger [-i|--campaign-id [CAMPAIGN-ID]] [--campaign-limit [CAMPAIGN-LIMIT]] [--contact-id [CONTACT-ID]] [--contact-ids [CONTACT-IDS]] [--min-contact-id [MIN-CONTACT-ID]] [--max-contact-id [MAX-CONTACT-ID]] [--thread-id [THREAD-ID]] [--max-threads [MAX-THREADS]] [--kickoff-only] [--scheduled-only] [--inactive-only] [-l|--batch-limit [BATCH-LIMIT]] [-d|--exclude [EXCLUDE]] [--bypass-locking] [-t|--timeout TIMEOUT] [-x|--lock_mode LOCK_MODE] [-f|--force]
mautic-cron |
mautic-cron | [08-May-2025 15:08:05 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/docroot/app/bundles/LeadBundle/Entity/CustomFieldRepositoryTrait.php on line 100
mautic-cron |
mautic-cron | Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/docroot/app/bundles/LeadBundle/Entity/CustomFieldRepositoryTrait.php on line 100
mautic-cron | [08-May-2025 15:08:05 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /var/www/html/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php on line 1
mautic-cron |
mautic-cron | Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /var/www/html/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php on line 1
Steps I have tried to fix the problem:
-
Set
PHP_INI_VALUE_MEMORY_LIMIT=4096M
in.mautic_env
and checked the System Info page that it was applied. -
The VPS where mautic is hosted has 8gb of RAM. Checked docker and it doesn’t seem to be limited.
-
Searched other memory configs where the value is set to 128M, like
opcache.memory_consumption
, set it manually to 1024.
docker-compose.yml
x-mautic-volumes:
&mautic-volumes
- ./mautic/config:/var/www/html/config:z
- ./mautic/logs:/var/www/html/var/logs:z
- ./mautic/media/files:/var/www/html/docroot/media/files:z
- ./mautic/media/images:/var/www/html/docroot/media/images:z
- ./mautic/themes:/var/www/html/docroot/themes:rw
- ./cron:/opt/mautic/cron:z
services:
db:
image: mysql:8.0
container_name: mautic-db
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
volumes:
- ./mysql-data:/var/lib/mysql
- ./mysql-conf.d:/etc/mysql/conf.d
healthcheck:
test: mysqladmin --user=$$MYSQL_USER --password=$$MYSQL_PASSWORD ping
start_period: 5s
interval: 5s
timeout: 5s
retries: 10
networks:
- default
logging:
driver: "json-file"
options:
max-size: "10m"
restart: unless-stopped
mautic_web:
image: mautic/mautic:5.2.4-apache
container_name: mautic-web
links:
- db:mysql
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_LOAD_TEST_DATA=${DOCKER_MAUTIC_LOAD_TEST_DATA}
- DOCKER_MAUTIC_RUN_MIGRATIONS=${DOCKER_MAUTIC_RUN_MIGRATIONS}
env_file:
- .mautic_env
healthcheck:
test: curl http://localhost
start_period: 5s
interval: 5s
timeout: 5s
retries: 100
depends_on:
db:
condition: service_healthy
networks:
- default
- caddy-net
logging:
driver: "json-file"
options:
max-size: "10m"
restart: unless-stopped
mautic_cron:
image: mautic/mautic:5.2.4-apache
container_name: mautic-cron
links:
- db:mysql
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_ROLE=mautic_cron
env_file:
- .mautic_env
depends_on:
mautic_web:
condition: service_healthy
networks:
- default
logging:
driver: "json-file"
options:
max-size: "10m"
restart: unless-stopped
mautic_worker:
image: mautic/mautic:5.2.4-apache
container_name: mautic-worker
links:
- db:mysql
volumes: *mautic-volumes
environment:
- DOCKER_MAUTIC_ROLE=mautic_worker
env_file:
- .mautic_env
depends_on:
mautic_web:
condition: service_healthy
networks:
- default
logging:
driver: "json-file"
options:
max-size: "10m"
restart: unless-stopped
networks:
caddy-net:
name: caddy-net
external: true
default:
name: ${COMPOSE_PROJECT_NAME}-docker
driver: bridge