How to fix the «bin/magento must be run as a CLI application» issue?

To diagnose this issue check an ouput of the php -v command:

The right case («cli»)

A wrong case («cgi-fcgi» instead of «cli»)

In a wrong case you should install or reconfigure the PHP Command Line Interface

An example of solution for PHP 7: http://magento.stackexchange.com/a/101262

Another solution (for some hostings) is to try to use php-cli instead of php