Applicable to:
- Plesk for Linux
Symptoms
- 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'
/opt/plesk/php/7.0/etc/php.ini allow_url_fopen=Off - Domain example.com has the same PHP handler selected in Domains > example.com > PHP Settings and
allow_url_fopen
directive is set to 'On'
OR
- '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
Cause
Custom PHP settings of the domain are not applicable for scheduled task, only directives from global php.ini take effect.
Resolution
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:
Workaround I
Use Run a command option instead of Run a PHP script in Domains > example.com > Scheduled Tasks. For example, to run
/var/www/vhosts/example.com/cron/task.php
:
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.
Workaround II
- 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.
Comments
0 comments
Please sign in to leave a comment.