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.
There is a WP core feature:
wp-config.php
could be just above WP root.If you additionally move
wp-content
to a sibling dir you could checkout WP core from GitHub/WordPress.wp-config.php
in document root is secure.