- Plesk for Linux
- Cannot run a PHP script via Domains > example.com > Scheduled Tasks:
PLESK_ERROR: PHP Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /var/www/vhosts/example.com/cron/task.php on line
- Directive mentioned in the error message is set to 'Off' in the server-wide php.ini file of PHP that is used to run scheduled task script , e.g. PHP 7.0:
# grep -i 'allow_url_fopen'
- Domain example.com has the same PHP handler selected in Domains > example.com > PHP Settings and
allow_url_fopendirective is set to 'On'
- 'memory_limit' parameter in Domains > example.com > PHP Settings does not take effect for scheduled task:
PLESK_ERROR: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 4096 bytes) in /var/www/vhosts/example.com/httpdocs/script.php on line 287
Custom PHP Settings specified for the domain are not applicable when scheduled task is configured, only directives from global php.ini takes effect.
Such functionality is yet to be implemented in Plesk.
Please take part in our product improvement by referring to the following link: Feature Suggestions
The top-ranked suggestions are likely to be included in the next versions of Plesk.
Use either of the following workarounds:
Use Run a command option instead of Run a PHP script in Domains > example.com > Scheduled Tasks.
For example, to run
on PHP 7.0 with php.ini used for example.com, add the following command:
/opt/plesk/php/7.0/bin/php -c /var/www/vhosts/system/example.com/etc/php.ini -f '/var/www/vhosts/example.com/cron/task.php'
Pay attention, that Access to the server over SSH should be set as /bin/bash. In order to make it available via /bin/bash (chrooted), refer to the following article:
1. Go to Domains > example.com > PHP Settings and identify PHP handler assigned to the domain
2. Change the PHP setting for PHP handler of the domain: