运行wp core安装时,wp-cli静默失败,错误为255

时间:2019-05-20 作者:Derek Held

在Docker容器(circleci/php:最新)中工作,我有点难以使用wp cli。当我尝试跑步时wp core install 我收到一个带有255个退出代码的无声故障。我启用了--debug,希望获得更多信息,但不幸的是,我只能看到它在读取wp config后停止。php。

circleci@142b5627c098:~/wordpress$ wp core install --url=example.com --title="Example" --admin_user=admin [email protected] --skip-email --debug
Debug (bootstrap): Fallback autoloader paths: phar://wp-cli.phar/vendor/autoload.php (0.01s)
Debug (bootstrap): Loading detected autoloader: phar://wp-cli.phar/vendor/autoload.php (0.011s)
Debug (commands): Adding command: cache (0.015s)
Debug (commands): Adding command: transient (0.017s)
Debug (commands): Adding command: comment (0.019s)
Debug (commands): Adding command: meta in comment Namespace (0.02s)
Debug (commands): Adding command: menu (0.021s)
Debug (commands): Adding command: item in menu Namespace (0.022s)
Debug (commands): Adding command: location in menu Namespace (0.022s)
Debug (commands): Deferring command: network meta (0.023s)
Debug (commands): Adding command: option (0.024s)
Debug (commands): Adding command: post (0.026s)
Debug (commands): Adding command: meta in post Namespace (0.026s)
Debug (commands): Adding command: term in post Namespace (0.027s)
Debug (commands): Adding command: post-type (0.028s)
Debug (commands): Adding command: site (0.03s)
Debug (commands): Adding command: meta in site Namespace (0.031s)
Debug (commands): Adding command: option in site Namespace (0.032s)
Debug (commands): Adding command: taxonomy (0.033s)
Debug (commands): Adding command: term (0.034s)
Debug (commands): Adding command: meta in term Namespace (0.035s)
Debug (commands): Adding command: user (0.037s)
Debug (commands): Adding command: meta in user Namespace (0.038s)
Debug (commands): Adding command: session in user Namespace (0.039s)
Debug (commands): Adding command: term in user Namespace (0.04s)
Debug (commands): Adding command: network (0.04s)
Debug (hooks): Processing hook "after_add_command:network" with 1 callbacks (0.04s)
Debug (hooks): On hook "after_add_command:network": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.04s)
Debug (commands): Adding command: meta in network Namespace (0.041s)
Debug (commands): Adding command: db (0.044s)
Debug (commands): Adding command: plugin (0.048s)
Debug (commands): Adding command: theme (0.05s)
Debug (commands): Adding command: mod in theme Namespace (0.051s)
Debug (commands): Adding command: scaffold (0.053s)
Debug (commands): Adding command: core (0.053s)
Debug (commands): Adding command: verify-checksums in core Namespace (0.054s)
Debug (commands): Adding command: verify-checksums in plugin Namespace (0.055s)
Debug (commands): Adding command: export (0.056s)
Debug (commands): Adding command: config (0.058s)
Debug (commands): Adding command: core (0.06s)
Debug (commands): Adding command: eval (0.061s)
Debug (commands): Adding command: eval-file (0.061s)
Debug (commands): Adding command: import (0.062s)
Debug (commands): Adding command: media (0.063s)
Debug (commands): Adding command: package (0.065s)
Debug (commands): Adding command: cron (0.066s)
Debug (commands): Adding command: event in cron Namespace (0.067s)
Debug (commands): Adding command: schedule in cron Namespace (0.067s)
Debug (commands): Adding command: embed (0.068s)
Debug (commands): Adding command: fetch in embed Namespace (0.068s)
Debug (commands): Adding command: provider in embed Namespace (0.069s)
Debug (commands): Adding command: handler in embed Namespace (0.069s)
Debug (commands): Adding command: cache in embed Namespace (0.07s)
Debug (commands): Adding command: i18n (0.07s)
Debug (commands): Adding command: make-pot in i18n Namespace (0.071s)
Debug (commands): Adding command: make-json in i18n Namespace (0.072s)
Debug (commands): Deferring command: language core (0.073s)
Debug (commands): Deferring command: language plugin (0.073s)
Debug (commands): Deferring command: language theme (0.074s)
Debug (hooks): Immediately invoking on passed hook "after_add_command:site": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/language-command/language-command.php at line 39 (0.074s)
Debug (commands): Adding command: switch-language in site Namespace (0.074s)
Debug (commands): Adding command: language (0.074s)
Debug (hooks): Processing hook "after_add_command:language" with 3 callbacks (0.074s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.074s)
Debug (commands): Adding command: core in language Namespace (0.075s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.075s)
Debug (commands): Adding command: plugin in language Namespace (0.076s)
Debug (hooks): On hook "after_add_command:language": Closure in file phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/class-wp-cli.php at line 634 (0.076s)
Debug (commands): Adding command: theme in language Namespace (0.076s)
Debug (commands): Adding command: maintenance-mode (0.077s)
Debug (commands): Adding command: rewrite (0.078s)
Debug (commands): Adding command: rewrite (0.078s)
Debug (commands): Adding command: cap (0.079s)
Debug (commands): Adding command: role (0.08s)
Debug (commands): Adding command: search-replace (0.082s)
Debug (commands): Adding command: server (0.082s)
Debug (commands): Adding command: shell (0.083s)
Debug (commands): Adding command: super-admin (0.083s)
Debug (commands): Adding command: widget (0.085s)
Debug (commands): Adding command: sidebar (0.085s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/cli.php (0.085s)
Debug (commands): Adding command: cli (0.087s)
Debug (commands): Adding command: cache in cli Namespace (0.088s)
Debug (commands): Adding command: alias in cli Namespace (0.088s)
Debug (bootstrap): Adding framework command: phar://wp-cli.phar/vendor/wp-cli/wp-cli/php/commands/help.php (0.088s)
Debug (commands): Adding command: help (0.089s)
Debug (bootstrap): No readable global config found (0.089s)
Debug (bootstrap): No project config found (0.089s)
Debug (bootstrap): argv: /usr/local/bin/wp core install --url=example.com --title="Example" --admin_user=admin [email protected] --skip-email --debug (0.09s)
Debug (bootstrap): ABSPATH defined: /home/circleci/wordpress/ (0.09s)
Debug (bootstrap): Set URL: example.com (0.09s)
Debug (bootstrap): Begin WordPress load (0.09s)
Debug (bootstrap): wp-config.php path: /home/circleci/wordpress/wp-config.php (0.09s)
circleci@142b5627c098:~/wordpress$
我尝试使用wp config create 仅使用最小值并进行目视检查,看起来很好,但没有变化。

2 个回复
最合适的回答,由SO网友:Derek Held 整理而成

我丢失了wp cli和/或WordPress所需的一些php扩展,但没有错误输出说明这么多。我猜这就是丢失的mysqli扩展。

我用了一个WP-CLI command 要测试基本容器是否缺少扩展,现在sudo docker-php-ext-install gd sockets mysqli exif 在我的配置中。yml。

感谢@leymannx链接了自己的回购协议,让我走上了正确的轨道。

SO网友:leymannx

啊!现在我刚刚看到,你在一个圆形容器里!我严重依赖CircleCI容器进行WordPress开发。我记得我曾经有过同样的问题。这是因为您的主机需要指定为127.0.0.1 具有--dbhost 像这样:

$ wp config create --dbname=circle_test --dbuser=root --dbpass="" --dbhost=127.0.0.1
我还有一份回购live工作样本,可以帮助您进一步:https://github.com/leymannx/wordpress-circleci-behat. 也许你可以检查一下.circleci/config.yml 从回购协议中找出罪魁祸首。