WP-CLI是否与AWS Lightsail上的Bitnami的Wordpress安装不兼容?

时间:2017-10-19 06:26:42

标签: wordpress ubuntu bitnami wp-cli amazon-lightsail

在Ubuntu上使用Wordpress的新实例,我通过these instructions安装了wp-cli。我试过了downloading the .phar package, chmodding it, etc。我也试过了installing a .deb package。在这两种情况下,我在运行wp plugin update --all --debug时都会遇到相同的错误:

Debug (bootstrap): No readable global config found (0.057s)
Debug (bootstrap): No project config found (0.057s)
Debug (bootstrap): argv: /usr/local/bin/wp plugin update --all --debug (0.057s)
Debug (bootstrap): ABSPATH defined: /opt/bitnami/apps/wordpress/htdocs/ (0.058s)
Debug (bootstrap): Begin WordPress load (0.058s)
Debug (bootstrap): wp-config.php path: /opt/bitnami/apps/wordpress/htdocs/wp-config.php (0.058s)
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(1070) : eval()'d code on line 90
PHP Notice:  Undefined index: HTTP_HOST in phar:///usr/local/bin/wp/php/WP_CLI/Runner.php(1070) : eval()'d code on line 91
Debug (bootstrap): Loaded WordPress (0.188s)
Debug (bootstrap): Running command: plugin update (0.188s)
Downloading update from https://downloads.wordpress.org/plugin/akismet.4.0.zip...
Using cached file '/home/bitnami/.wp-cli/cache/plugin/akismet-4.0.zip'...
Unpacking the update...
Warning: Could not create directory.
Downloading update from https://downloads.wordpress.org/plugin/all-in-one-wp-migration.6.58.zip...
Using cached file '/home/bitnami/.wp-cli/cache/plugin/all-in-one-wp-migration-6.58.zip'...
Unpacking the update...
Warning: Could not create directory.
Downloading update from https://downloads.wordpress.org/plugin/all-in-one-seo-pack.2.4.2.zip...
Using cached file '/home/bitnami/.wp-cli/cache/plugin/all-in-one-seo-pack-2.4.2.zip'...
Unpacking the update...
Warning: Could not create directory.
Downloading update from https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.6.2.4.zip...
Using cached file '/home/bitnami/.wp-cli/cache/plugin/google-analytics-for-wordpress-6.2.4.zip'...
Unpacking the update...
Warning: Could not create directory.
Downloading update from https://downloads.wordpress.org/plugin/jetpack.5.4.zip...
Using cached file '/home/bitnami/.wp-cli/cache/plugin/jetpack-5.4.zip'...
Unpacking the update...
Warning: Could not create directory.
+--------------------------------+-------------+-------------+--------+
| name                           | old_version | new_version | status |
+--------------------------------+-------------+-------------+--------+
| akismet                        | 3.3.4       | 4.0         | Error  |
| all-in-one-wp-migration        | 6.55        | 6.58        | Error  |
| all-in-one-seo-pack            | 2.3.15      | 2.4.2       | Error  |
| google-analytics-for-wordpress | 6.2.0       | 6.2.4       | Error  |
| jetpack                        | 5.2.1       | 5.4         | Error  |
+--------------------------------+-------------+-------------+--------+
Success: Plugins already updated.

我已经浏览了list of support options,而我仍然无法让wp-cli在AWS Lightsail(又名Bitnami)上正常运行。查看githubwordpress.org forums,我发现很多用户都有上述部分或全部错误。我尝试了所有建议的解决方法:

  • wp-config.php:将ABSPATH行包装在条件中。
  • wp-config.php:将add_filter()电话移至MU插件。
  • 多次chmodchown更改。

其中一些确实会使各自的错误消失,但wp仍然无法更新插件等。

我是否需要创建PHP调试输出中标识的缺失文件?

我应该不使用AWS Lightsail / Bitnami吗?我真的需要wp-cli,所以我愿意转移到ec2或其他任何地方。

3 个答案:

答案 0 :(得分:5)

我在那里看到两个不同的问题。

  1. 您在$_SERVER['HTTP_HOST']文件中使用wp-config.php, 在运行WP-CLI时未设置。由于WP-CLI是作为一个运行的 命令行工具,一些仅限Web的常量/变量 没有设置。您需要手动设置或提供 条件覆盖。

  2. WordPress本身无法创建解压缩目录 下载的插件存档文件。这可能是由于1.以上(如 WordPress可能正在寻找错误的位置),或者它可能是一个 无关的问题,比如使用不同的用户运行WP-CLI 没有所需的权限。

  3. 这两个问题不是由WP-CLI直接引起的,而是由WordPress安装的特定设置引起的。

答案 1 :(得分:2)

Bitnami开发者在这里。

您可以尝试以用户daemon身份运行命令吗?

 sudo su -s /bin/bash daemon

这是有权在服务器上写入的用户

答案 2 :(得分:2)

谢谢Javier Salmeron!这正是我必须做的,按顺序:

sudo su -s /bin/bash daemon

export PATH=/opt/bitnami/varnish/bin:/opt/bitnami/sqlite/bin:/opt/bitnami/php/bin:/opt/bitnami/mysql/bin:/opt/bitnami/apache2/bin:/opt/bitnami/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

cd /home/bitnami/apps/wordpress/htdocs

现在它起作用了,因为以下是真的:

  1. 我是用户daemon
  2. 我的$PATH能够找到/opt/bitnami/php/bin/php
  3. 我在正确的目录中:/home/bitnami/apps/wordpress/htdocs
  4. 以下命令成功运行:wp plugin update --all --debug

    Debug (bootstrap): No readable global config found (0.058s)
    Debug (bootstrap): No project config found (0.059s)
    Debug (bootstrap): argv: /usr/local/bin/wp plugin update --all --debug (0.059s)
    Debug (bootstrap): ABSPATH defined: /opt/bitnami/apps/wordpress/htdocs/ (0.059s)
    Debug (bootstrap): Begin WordPress load (0.061s)
    Debug (bootstrap): wp-config.php path: /opt/bitnami/apps/wordpress/htdocs/wp-config.php (0.061s)
    Debug (bootstrap): Loaded WordPress (0.678s)
    Debug (bootstrap): Running command: plugin update (0.679s)
    PHP Warning:  mkdir(): Permission denied in phar:///usr/local/bin/wp/php/WP_CLI/FileCache.php on line 265
    Warning: mkdir(): Permission denied in phar:///usr/local/bin/wp/php/WP_CLI/FileCache.php on line 265
    Downloading update from https://downloads.wordpress.org/plugin/akismet.4.0.zip...
    Unpacking the update...
    Installing the latest version...
    Removing the old version of the plugin...
    Plugin updated successfully.
    Downloading update from https://downloads.wordpress.org/plugin/all-in-one-wp-migration.6.59.zip...
    Unpacking the update...
    Installing the latest version...
    Removing the old version of the plugin...
    Plugin updated successfully.
    Downloading update from https://downloads.wordpress.org/plugin/all-in-one-seo-pack.2.4.2.zip...
    Unpacking the update...
    Installing the latest version...
    Removing the old version of the plugin...
    Plugin updated successfully.
    Downloading update from https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.6.2.4.zip...
    Unpacking the update...
    Installing the latest version...
    Removing the old version of the plugin...
    Plugin updated successfully.
    Downloading update from https://downloads.wordpress.org/plugin/jetpack.5.4.zip...
    Unpacking the update...
    Installing the latest version...
    Removing the old version of the plugin...
    Plugin updated successfully.
    +--------------------------------+-------------+-------------+---------+
    | name                           | old_version | new_version | status  |
    +--------------------------------+-------------+-------------+---------+
    | akismet                        | 3.3.4       | 4.0         | Updated |
    | all-in-one-wp-migration        | 6.55        | 6.59        | Updated |
    | all-in-one-seo-pack            | 2.3.15      | 2.4.2       | Updated |
    | google-analytics-for-wordpress | 6.2.0       | 6.2.4       | Updated |
    | jetpack                        | 5.2.1       | 5.4         | Updated |
    +--------------------------------+-------------+-------------+---------+
    Success: Updated 5 of 5 plugins.