https://www.ndchost.com/wiki/cloudlinux/how-to-add-wp-cli-to-cagefs-users

How to add the wordpress command line tool wp-cli for CageFS users on CloudLinux

To start we need to download the wp-cli php archive (phar) file and move it a logical folder of our choice with exicute permissions:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
chmod +x /usr/local/bin/wp

Next the path needs to be added to the cloud linux configuration file, you can do this by modifying the existing binunitls config file. edit '/etc/cagefs/conf.d/binutils.cfg' with a text editor of your choice such as vi or nano:

nano /etc/cagefs/conf.d/binutils.cfg

Add the following to the bottom of the file with the path using the path you chose in the move (mv) command above:

[custom]
comment=custom paths
paths=/usr/local/bin/wp

Next, we need cagefsctl to pick up the change by running the following command:

cagefsctl --force-update

You will see a number of files checked but you should see your path at the bottom as follows:

“Copying /usr/local/bin/wp to /usr/share/cagefs-skeleton/usr/local/bin/wp”

Testing:

You can test this in a user shell by joining it with su. For this example we will assume you have a user on the system called 'example' and in our case the user was not given a system shell so we assign one with -s. then test we are the user with 'whoami' and check for the file with 'stat':

su -s /bin/bash example
whoami
stat /usr/local/bin/wp


Last Tested — 2019-11-11 16:17:03

Test Environment: