Symptoms
-
Scheduled task fails with the following error:
PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes)
-
The scheduled task is created at Tools & Settings > Scheduled Tasks (Cron jobs) with Type Run a command. It should run PHP script and has no limits set with
memory_limit
directives:/usr/bin/env php "/var/www/vhosts/example.com/httpdocs/index.php" "option1=qq"
Cause
PHP memory limit is exceeded.
Resolution
In case the scheduled task is using the root user identity
-
Go to Tools & Settings > Scheduled Tasks (Cron jobs) and select the affected task.
-
In the Command field, add the directive
memory_limit
with required value:/usr/bin/env php "/var/www/vhosts/example.com/httpdocs/index.php" "option1=qq" -d memory_limit=128M
In case the scheduled task is using the domain system user identity
-
Increase
memory_limit
value server-wide in Plesk > Tools & Settings > PHP Settings > click PHP version > edit php.ini