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!


2 Answers 2


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. Feb 10, 2016 at 16:15

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

php7.0-cli bin/magento 

list command

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