After upgrading to php 7 bin/magento CLI commands not working Magento 2.0.2 CE
-
28-09-2020 - |
Question
I've upgraded the php version of the apache2.4 server from 5.6 to 7.0. OS version Ubuntu 14.04 LTS. After this update, despite the fact that I've installed php7.0-cli, when i try to run
php7.0 bin/magento list command
I get the fallowing output:
Content-type: text/html; charset=UTF-8
bin/magento must be run as a CLI application
Output when I run sudo apt-get install php7.0-cli:
php7.0-cli is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
When I go to the bin directory and try to run the command :
magento list
I get the output:
magento: command not found
Any help would be appreciated!
Solution
what is the output of:
ls -l $(which php)
For me this is showing:
/usr/bin/php -> /etc/alternatives/php
Also check the output of this:
echo $PATH
And look for any path to the wrong php, maybe you only need to fix the $PATH.
If this is not working try this to reinstall the whole package, overwriting the original files:
sudo apt-get install --reinstall php7.0-cli
OTHER TIPS
There is No need to reinstall PHP. You just do this command
php7.0-cli bin/magento
list command
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange