You can install WordPress CLI using SSH. It can be installed without root access. If you do not have SSH access, contact support to have it enabled for your account.
How to install WP-CLI:
Execute the following commands, one line at a time, to install WP-CLI. You will need to install it only once for the lifetime of your hosting account.
- Log in to SSH
- Download WP-CLI:
cd ~
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- Provide execute permissions:
chmod +x wp-cli.phar
- Create an alias to make it easier to use:
alias wp='~/wp-cli.phar'
echo "alias wp='~/wp-cli.phar'" >> ~/.bashrc
WP-CLI is now installed on your hosting account.
How to run WP-CLI:
- Log in to SSH
- Go to the installation directory of your website.
The default directory is public_html:cd ~/public_html
The default directory for an addon domain is the domain name (e.g. example.com):cd ~/example.com
You can view the installation directory from cPanel > Domains - Execute a command, eg. view the configuration details:
wp config list
- Execute other commands in a similar fashion.
Make sure to change your working directory to the WordPress installation directory before executing any command.
How to run WP-CLI from the home directory:
Specify which WordPress site to control with the "--path" option:wp config list --path=/home/username/public_html
Make sure to replace <username> with your actual username for the cPanel account.
Helpful Guides:
WordPress CLI handbook has many useful guides on how to use WP-CLI:https://make.wordpress.org/cli/handbook/how-to/