Is WP-CLI incompatible with Bitnami's Wordpress install on AWS Lightsail?
I see two different issues there.
You're using
$_SERVER['HTTP_HOST']
in yourwp-config.php
file,which is not set while WP-CLI is being run. As WP-CLI is run as acommand-line tool, some of the web-only PHP constants/variables arenot set. You'll need to either set these manually or provide aconditional override.WordPress itself cannot create a directory in which to unpack thedownloaded plugin archive files. This might be due to 1. above (asWordPress might be looking in the wrong location), or it might be anunrelated issue, like running WP-CLI with a different user that doesnot have the required permissions.
Both issues are not directly caused by WP-CLI, but rather the result of the particular setup of your WordPress installation.
Bitnami Developer here.
Could you try running the commands as the user daemon
?
sudo su -s /bin/bash daemon
This is the user that has permission to write on the server
Thank you Javier Salmeron! Here is exactly what I had to do, in order:
sudo su -s /bin/bash daemonexport 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/gamescd /home/bitnami/apps/wordpress/htdocs
Now it worked because the following was true:
- I was user
daemon
. - My
$PATH
was able to find/opt/bitnami/php/bin/php
. - I was in the correct directory:
/home/bitnami/apps/wordpress/htdocs
The following command ran successfully: 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 265Warning: mkdir(): Permission denied in phar:///usr/local/bin/wp/php/WP_CLI/FileCache.php on line 265Downloading 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.