How to Update WP-CLI

Reading Time: 2 minutesWP-CLI is a command line tool for interacting with and managing WordPress sites. In our previous article on How to Install WP-CLI we covered the process of installing WP-CLI onto a server. We did this in a way that the tool would be accessible by any user on the server. This prevents the need for your users to install the tool locally.

Updating WP-CLI on your server

In order to follow this tutorial you will need have installed WP-CLI based on the directions we provide in How to Install WP-CLI.

Pre-flight Check:

  • Root-level command line access via SSH is required to follow this tutorial.
  • PHP 5.3.29, or higher, will be required for wp-cli to function.
  • WP-CLI already installed per How to Install WP-CLI
  • WordPress 3.7, or later, is required for wp-cli support.
To update the WP-CLI tool you should login to your serve as root via SSH. Once logged in, execute: root@server [~]# wp cli update --allow-root If your WP-CLI install requires an update you will see something like: You have version 0.23.1. Would you like to update to 1.1.0? [y/n] To continue you will need to provide confirmation by typing ‘y‘. After you confirm you will see: Downloading from New version works. Proceeding to replace. Success: Updated WP-CLI to 1.1.0 Your servers WP-CLI has now been updated! Your users can continue using the latest version of WP-CLI.

Check Your Work!

To double check you work you can run the info command to ensure WP-CLI has been updated. If the update command reports a success this shouldn’t be necessary at all, but it’s always good to check! To double check that the upgrade was a success execute: root@server [~]# wp --info --allow-root The output should be similar to: root@server [~]# wp --info --allow-root PHP binary: /opt/cpanel/ea-php56/root/usr/bin/php PHP version: 5.6.30 php.ini used: /opt/cpanel/ea-php56/root/etc/php.ini WP-CLI root dir: phar://wp-cli.phar WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 1.1.0

Author Bio

About the Author: David Singer

I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Refer a friend and get hosting credit!