Skip to content

Increase memory_limit in the database sync command #50

@alexmerlin

Description

@alexmerlin

Bug Report

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 132059512 bytes) in /var/www/admin.dotkernel.localhost/html/vendor/laminas/laminas-filter/src/Compress/Gz.php on line 213

We need to increase the amount of memory the geoip:synchronize command can consume.

We have three options here:

  1. Hardcode in the command with:
ini_set('memory_limit', '256M');
  1. Add an argument where developers can set the amount of memory the command can consume:
php ./bin/cli.php geoip:synchronize --memory-limit 256M
  1. Add a config where developers can set the amount of memory the command can consume:
return [
    'dot-geoip' => [
        'memoryLimit' => 256, // Megabytes
        'targetDir' => getcwd() . '/data/geoip',
        'databases' => [
            LocationService::DATABASE_ASN     => [
                'source' => 'https://download.db-ip.com/free/dbip-asn-lite-{year}-{month}.mmdb.gz',
            ],
            LocationService::DATABASE_CITY    => [
                'source' => 'https://download.db-ip.com/free/dbip-city-lite-{year}-{month}.mmdb.gz',
            ],
            LocationService::DATABASE_COUNTRY => [
                'source' => 'https://download.db-ip.com/free/dbip-country-lite-{year}-{month}.mmdb.gz',
            ],
        ],
    ],
];

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions