WordPress users who host their sites in CloudLinux and CageFS via cPanel are regular users of the wp-cli command line interface. If wp-cli is not already present on your CloudLinux-powered cPanel/WHM server, we will show you how to install it. Server administrators who have installed CloudLinux/CageFS on their servers and would like to offer their customers access to wp-cli via cPanel will find helpful information in this document. If your hosting service doesn’t offer it, regular account holders can simply download it and start using it. That is a totally different article.
How to install wp-cli in a cPanel/WHM server with CloudLinux
Launch a secure shell (SSH) session to the cPanel/WHM server with the root user’s credentials. Then, to set up wp-cli, type in these commands:
cd
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
If you have installed wp-cli, then let’s make it available to other users by adding it to the CageFS.
vim /etc/cagefs/conf.d/wpcli.cfg
[wpcli]
comment=Allow wp-cli to work on the server
paths=/usr/local/bin/wp
The next step is to upgrade CageFS.
cagefsctl --force-update
Become a CageFS user and see if it really works.
su cagefsuser
wp --info