How to Update WP-CLI

WP-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 https://github.com/wp-cli/wp-cli/releases/download/v1.1.0/wp-cli-1.1.0.phar...
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

Be Sociable, Share!

About the Author: Dan Pock

Dan Pock does Technical Writing & Marketing at Liquid Web with a background in System Administration, Public Relations, and Customer Service.

His favorite things include: his cats, Oscar Boots and Dash Nouget; experimenting with PHP; and making up recipes (or at least attempting to). You can find his coding hijinks on GitHub, where he shares most of his projects and open source work.

Here's 75 % off, Launch a New VPS Today. Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7 Heroic Support