You are running a customized WordPress install where your configurations are NOT located in one of the two required locations (outside the webroot for example) and are receving the following error when running wp-cli
commands:
Error: Strange wp-config.php file: wp-settings.php is not loaded directly.
###Solution
Simply move the require_once ... wp-settings.php
line from the actual configuration file to the end of file that is requiring/including it. See below for examples.
This works by tricking the wp-cli regex into correctly parsing the configuration files.
Why would it be secure? It is still inside the public webroot. This can lead to severe leaks - explained here
And @samstoller: Thank you for this useful gist!