If the command "php bin/magento list" does not return the list of all Magento 2 available commands (empty output). Same happens for other commands.
php bin/magento list

Open bin/magento in your preferred file editor and add the following line and save:
ini_set('display_errors', 1); // allow PHP errors reportingRun the command again:
php bin/magento listIf you get Fatal error: Allowed memory size of x bytes exhausted (tried to allocate y bytes), then it is a memory issue. Increase the memory limit by adding the following line then save.
ini_set('memory_limit','800M');Run the command again:
php bin/magento listto see if it works.
Method 2:
add -d memory_limit=XX
example: php -d memory_limit=4G bin/magento setup:di:compile