- Plesk for Linux
The following error occurs on attempt to run a PHP script from Domains > example.com > Scheduled Tasks:
PLESK_ERROR: Task "php -q /var/www/vhosts/example.com/crons/test.php -option1" completed with error in 0 seconds. See Details
-: php: command not found
PLESK_ERROR: The file /var/www/vhosts/example.com/httpdocs/billing/crons/cron.php was encoded with the PHP 5.6 ionCube Encoder and requires PHP 5.6 to be installed.
PHP version 5.6 is required to run a PHP script.
System PHP version is 5.4:
# php -v
PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.0.18, Copyright (c) 2002-2015, by ionCube Ltd.
The system PHP binary is specified in the command, while a higher version should be used to run a PHP script:
If the option Task type is set as Run a command and a PHP binary is specified as
php, the system PHP will be used to run the command.
If the option Task type is set as Run a PHP script, Plesk will use the system PHP to run the command.
Connect to the Plesk server via SSH.
Get a list of installed PHP handlers:
# plesk bin php_handler --list
Find a required PHP version and copy its path under the php-cli column, for example
Go to Plesk > Tools & Settings > Scheduled Tasks > Add Task.
Set the option Task type as Run a command.
Paste a path from the step 2 to the Command field, so the full command will look like:
PLESK_INFO: /opt/plesk/php/5.6/bin/php /var/www/vhosts/example.com/httpdocs/billing/crons/cron.php