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!


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
  • 1
    Yeah... "sudo apt-get install --reinstall php7.0-cli" did the job. Thanks a lot. – Lachezar Raychev Feb 10 '16 at 16:15

There is No need to reinstall PHP. You just do this command

php7.0-cli bin/magento 

list command

protected by Community Apr 30 at 6:38

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.