- Plesk for Linux
- The following error occurs on an attempt to 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 5.6:
# 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'
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, refer to the following article for detailed information: PHP settings for a domain are not propagated for a scheduled task
As a workaround, it is possible to use Run a command option instead of Run a PHP script in Domains > example.com > Scheduled Tasks.
For example, to run
on PHP 5.6 with php.ini used for example.com, add the following command:
/opt/plesk/php/5.6/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: