admin管理员组文章数量:1122846
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,
Julien
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,
Julien
Share Improve this question asked Sep 19, 2016 at 11:59 Julien NicouleaudJulien Nicouleaud 11 bronze badge2 Answers
Reset to default 1If 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
An old thread, I know but I recently has this problem. I had prepended the path to composer's wp to the PATH env var and the following produced the expected output:
% wp --info
OS: Darwin 21.6.0 Darwin Kernel Version 21.6.0: Mon Jun 24 00:56:10 PDT 2024; root:xnu-8020.240.18.709.2~1/RELEASE_X86_64 x86_64
Shell: /bin/zsh
PHP binary: /usr/local/bin/php
PHP version: 8.3.11
php.ini used: /usr/local/etc/php/8.3/php.ini
MySQL binary: /usr/local/bin/mysql
MySQL version: mysql Ver 9.0.1 for macos12.7 on x86_64 (Homebrew)
SQL modes:
WP-CLI root dir: /usr/local/var/www/wordpress/wp-content/plugins/wp-simple-google-appointments/vendor/wp-cli/wp-cli
WP-CLI vendor dir: /usr/local/var/www/wordpress/wp-content/plugins/wp-simple-google-appointments/vendor
WP_CLI phar path:
WP-CLI packages dir:
WP-CLI cache dir: /Users/XxXxXxX/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.11.0
But everything else exited with no output and with exit code zero. The --debug
flag did not show any errors.
This was because I was missing the following (from the require-dev
section) in my composer.json
:
"wp-cli/db-command" : "^2",
"wp-cli/entity-command" : "^2",
"wp-cli/extension-command" : "^2",
"wp-cli/package-command" : "^2"
By default, wp-cli/wp-cli
just installs the WPCLI container without any WPCLI commands installed!
EDIT: Or require wp-cli/wp-cli-bundle
for a selection of most WPCLI commands.
本文标签: directoryWpCLI not working with WordPress installed with composer
版权声明:本文标题:directory - Wp-CLI not working with WordPress installed with composer 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736287410a1927874.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论