Fatal Memory Size Errors

Problem

You see the following error when the system terminates the system cron run:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 20480 bytes)

In other cases, the system cron fails to run.

Cause

This error indicates that the system is terminating the cron job because it has exceeded the memory_limit value of 32 MB.

You can check the limit using the following command:

php -ini | grep "memory_limit"

Solution

To resolve this issue, choose one of the following options:

  • Increase the memory_limit value to 64 MB (minimum) or 128 MB (recommended) to resolve this.
    For help, contact your server administrator or hosting provider.
  • Set the memory_limit value directly in the cron command. For example: php -d memory_limit=128M -q /path/to/whmcs/crons/cron.php

Last modified: November 12, 2024