- Plesk for Linux
- Cannot run 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
- 'allow_url_fopen' directive is set to 'Off' in the server-wide PHP handler configuration:
# 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 of the domain are not applicable for scheduled task, only directives from global php.ini take effect.
Using domain PHP settings for PHP script run by scheduled task is yet to be implemented in Plesk.
Vote for this feature at Plesk UserVoice portal.
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
CONFIG_TEXT: /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 this article.
- Go to Domains > example.com > PHP Settings and identify PHP handler assigned to the domain
- Go to Tools & Settings > PHP Settings, click the handler identified on the previous step and change the required setting there.
Please sign in to leave a comment.