Fixing wp-cli broken alias on and other hosts

wp-cliGood on for two things:

1 – working to update millions of old wordpress sites to modern standards for security reasons.

2 – making wp-cli available by default to everyone using a command shell (including me)

Unfortunately, I went to use wp-cli yesterday and ran into a problem. It turns out that wordpress v4.4 broke earlier versions of wp-cli, and the most recent version is necessary to continue using it.

This took a while to figure out, and there doesn’t seem to be any bluehost-specific info via google as yet. Other shared hosts are also making wp-cli available and may have the same issues.

Here is an outline of what I did to get it working:

  1. Install wp-cli in a local directory. Make sure your install directory is outside of your wordpress install, and outside any apache-servable directories such as ~/public_html. This is easy enough to do, as documented on
  2. The tricky part was to recognize that bluehost (and other hosts?) set up a global alias for ‘wp’ that points to their now-outdated-and-broken version.After the sufficient amount of hair pulling, I discovered that at first what looked like some kind of php version mismatch was rather an alias I didn’t really want anymore.
  3. To discover the alias your host is using, “#alias wp”.  Copy the result to your  ~/.bash_profile. Edit the part that points to the wp executable to point to your new install. In the case of the bluehost alias, that is the last part of the command. Finally,  put the new alias into effect by “#source ~/.bash_profile”.After that, all worked fine for me.
Posted in General Information.