I've installed a version of Wordpress using composer, and modified the default folders for the content (/wp-content) and the core (/wp).

My wp-config.php gets its DB_NAME, DB_USERNAME, DB_PASSWORD from environment variables defined in the .htaccess file.

I am able to connect to my wordpress instance using my browser, so the connection information in there is fine.

I have not managed to get wp-cli to run on this instance. wp-cli --debug outputs:

Debug (bootstrap): No readable global config found (0.014s)
Debug (bootstrap): No project config found (0.016s)
Debug (bootstrap): No package autoload found to load. (0.261s)
Debug (bootstrap): ABSPATH defined: /path/to/core/ (0.272s)
Debug (bootstrap): Begin WordPress load (0.288s)
Debug (bootstrap): wp-config.php path: /path/to/wp-config.php (0.292s)
Error: Error establishing a database connection

(I've double checked these paths and they are correct)

I keep getting that same error. I've tried installing a clean instance using composer, but this time :

  • without any plugin
  • without any theme
  • by defining the DB_NAME, DB_USERNAME, DB_PASSWORD directly in the wp-config.php file rather than getting those from env. variables.
  • but I kept the custom folder structure /wp for the core and /wp-content for the content

Still the same error... Am I missing something ? Is it the custom folder structure that wp-cli doesn't like ?

Executing wp-cli --info outputs this :
PHP binary: /usr/bin/php
PHP version:    5.5.36
php.ini used:
WP-CLI root dir:    phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 0.24.1

I'm on Max OS X El Capitan.

Thanks a lot for your help,


1 Answer 1


If you are calling WP-CLI from the parent directory you need to tell it where core is using --path

$ wp --path=path/to/core

Some more details here: http://wp-cli.org/config/

You can set also set this with a config file wp-cli.yml that contains

path: path/to/core

Details: http://wp-cli.org/config/#config-files

  • Hey, thanks kraftner ! I've tried wp --path htdocs/wp when I execute if from above htdocs but it still doesn't work... It finds the correct path to my w^-config.php file, so I really dont't get why it doesn't work. Any chance it could be something like the version of PHP or the way the connection to MySQL is supposed to work ? Sep 19, 2016 at 18:15
  • Ahhhh... Found : I installed wp-cli outside of my VM, so the localhost it finds in my wp-config.phpdoesn't quite work :) Sep 19, 2016 at 18:35
  • 1
    :) Good you resolved it. Maybe you want to add that as an answer too and accept it. I guess this is a pretty common mistake to make so other would profit from this.
    – kraftner
    Sep 20, 2016 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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