How to enable wp-cli on a Cloudlinux / cPanel server


Written by Dennis Nind

Last published at: February 8th, 2019

This page describes how to install wp-cli in a cPanel/WHM server with CloudLinux, of course our cPanel comes with wp-cli preinstalled. This page should be used by system admins who want to make wp-cli available to their customers in cPanel with CloudLinux/CageFS installed. First, SSH to the cPanel/WHM server as the root user. Next, run these commands to install wp-cli:

curl -O
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp

Now, as you have installed wp-cli, let’s add it to the CageFS so that users could access it

vim /etc/cagefs/conf.d/wpcli.cfg

And add this content:

comment=Allow wp-cli to work on the server

Next, update CageFS

cagefsctl --force-update

Test to see if it works, become a CageFS user.

su cagefsuser
wp --info