2017-10-19 117 views
3

在Ubuntu上使用一個新的WordPress實例,我通過these instructions安裝wp-cli。我試過downloading the .phar package, chmodding it, etc。我也試過installing a .deb package。在這兩種情況下,我跑wp plugin update --all --debug時,你得到同樣的錯誤:WP Lights與AWS Lightsail上的Bitnami Wordpress安裝不兼容?

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或其他任何方式。

回答

2

Bitnami Developer here。

你可以嘗試以用戶daemon的身份運行命令嗎?

sudo su -s /bin/bash daemon 

這是一個有權在服務器上寫用戶

+0

這就是解決方案。謝謝!這正是我要做的,按順序: 'sudo su -s/bin/bash守護進程 export PATH =/opt/bitnami/varnish/bin:/ opt/bitnami/sqlite/bin:/ opt/bitnami/PHP /箱中:/ opt/bitnami/MySQL的/斌:/選擇/ bitnami/Apache2的/ bin中中:/ opt/bitnami /普通/斌:在/ usr/local/sbin中:在/ usr/local/bin目錄:在/ usr/sbin:/ usr/bin:/ sbin:/ bin:/ usr/games:/ usr/local/games cd/home/bitnami/apps/wordpress/htdocs wp plugin update --all --debug 。 .. 成功:更新了5個插件。 ' –

+0

另請參閱下面我的使用您的解決方案的更好格式的版本。再次感謝。 –

4

我看到兩個不同的問題。

  1. 你在你的wp-config.php文件中使用$_SERVER['HTTP_HOST'], 而WP-CLI正在運行,沒有設置。由於WP-CLI是作爲 命令行工具運行的,因此一些僅限Web的PHP常量/變量未設置爲 。您需要手動設置或提供 條件覆蓋。

  2. WordPress本身無法創建一個目錄,在其中解壓縮下載的插件歸檔文件 。這可能是由於上面的1.(因爲 WordPress可能在錯誤的位置查找),或者它可能是 無關的問題,如使用不同的用戶運行WP-CLI,而 不具有所需的權限。

這兩個問題都不是由WP-CLI直接引起的,而是由於您的WordPress安裝的特殊設置的結果。

+0

謝謝。我正在使用Wordpress的Bitnami安裝提供的'wp-config.php'文件。我可以簡單地下載或創建一個與WP-CLI兼容的文件版本嗎? –

+1

我不知道該文件包含什麼。我必須假設他們在那裏有一些特殊的配置,所以下載一個標準的配置文件可能會破壞。 –

2

謝謝哈維爾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

以下命令運行成功: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.