Many customers who run WordPress websites in a cPanel hosting with CloudLinux and CageFS, ask us about using wp-cli in cPanel.
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:
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
Now, as you have installed wp-cli, let’s add it to the CageFS so that users could access it
And add this content:
[wpcli] comment=Allow wp-cli to work on the server paths=/usr/local/bin/wp
Next, update CageFS
Test to see if it works, become a CageFS user.
su cagefsuser wp --info
To benefit from (benchmarked) fast cPanel hosting, including free as-is cPanel account migration,