skip to Main Content

Using a new instance of WordPress on Ubuntu, I installed wp-cli via these instructions. I tried downloading the .phar package, chmodding it, etc.I also tried installing a .deb package. In both cases I get the same errors when running 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.

I’ve run through the list of support options and I’m still unable to get wp-cli to work properly on AWS Lightsail, aka Bitnami. Looking at the github and wordpress.org forums, I see that lots of users have had some or all of the above errors. I tried all the suggested work-arounds:

  • wp-config.php: Wrap the ABSPATH line in a conditional.
  • wp-config.php: Move the add_filter() call into a MU plugin.
  • Several chmod and chown changes.

Some of these did make their respective errors go away, but wp still can’t update plugins, etc.

Do I need to create the missing files identified in the PHP debug output?

Should I just not use AWS Lightsail/Bitnami? I really need wp-cli, so I’m willing to just move to ec2 or whatever else.

3

Answers


  1. Chosen as BEST ANSWER

    Thank you Javier Salmeron! Here is exactly what I had to do, in order:

    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
    

    Now it worked because the following was true:

    1. I was user daemon.
    2. My $PATH was able to find /opt/bitnami/php/bin/php.
    3. 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 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.
    

  2. I see two different issues there.

    1. You’re using $_SERVER['HTTP_HOST'] in your wp-config.php file,
      which is not set while WP-CLI is being run. As WP-CLI is run as a
      command-line tool, some of the web-only PHP constants/variables are
      not set. You’ll need to either set these manually or provide a
      conditional override.

    2. WordPress itself cannot create a directory in which to unpack the
      downloaded plugin archive files. This might be due to 1. above (as
      WordPress might be looking in the wrong location), or it might be an
      unrelated issue, like running WP-CLI with a different user that does
      not 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.

    Login or Signup to reply.
  3. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search