WP-CLI on Shared Hosting

Did you know you’re able to install the WordPress command line interface on your shared host—provided you’ve got SSH access? Even if you can’t move wp-cli.phar to your /usr/local/bin/ as per the official installation instructions, you can still set up an alias for the wp command in .bashrc.

Installing WP-CLI

Start off—as per the manual—by simply downloading WP-CLI.

cd
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Verifying is done like so:

php wp-cli.phar ---info

Our next step’s to make the file executable:

chmod +x wp-cli.phar

Defining the WP Command

Now, where the manual says to move wp-cli.phar to /usr/local/bin/ to make it available system-wide, we’ll instead add the following line to .bashrc:

alias wp="~/wp-cli.phar"

Running multiple WordPress installs that live in subfolders of your home directory? Just cd into them and run any wp command!

One response to “WP-CLI on Shared Hosting”

  1. Jan Boddez

    […] Got shared hosting with SSH access? Let’s get Composer up and running, the same way we did with WP-CLI. […]