Symptoms
-
Unable to execute any magento command, including running a Magento script under PHP:
# php magento indexer:reindex
Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.htmlor:
# ./magento module:enable <module-list>
Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. -
Domain uses PHP 7.0 or higher version in Domains > example.com > PHP Settings;
-
System PHP (PHP by OS vendor) version is 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.
Cause
Commands “php magento” or “./magento” are executed from a system PHP (PHP by OS vendor) which is not supported by Magento.
Note: The magento
executable can be stored in /var/www/vhosts/example.com/httpdocs/bin/magento
. So it might be needed to use the full way in the command.
Resolution
Run the command from within PHP version that domain uses:
Note: substitute ‘<command name>’ with an actual command required to execute.
# /opt/plesk/php/7.0/bin/php magento <command name>
or:
# /opt/plesk/php/7.0/bin/php ./magento <command name>
Alternatively, export path to a binary file of PHP 7.0 to the variable and run the command:
# export PATH=/opt/plesk/php/7.0/bin:$PATH
# ./magento <command name>
Note: substitute ‘<command name>’ with an actual command required to execute. Click here to see the list of available commands.