WP-CLI is a command-line interface for managing WordPress websites. It allows you to update plugins, manage users, verify WordPress files, and perform various maintenance tasks directly from a terminal.
In this guide, we’ll show you how to install WP-CLI on your cPanel hosting account without requiring root or server administrator privileges.
Log in to cPanel and navigate to Advanced -> Terminal. Alternatively, you can connect using SSH if SSH access is enabled for your hosting account.
Create a bin directory in your home folder, download WP-CLI, and make it executable:
mkdir -p "$HOME/bin"
curl -fsSL -o "$HOME/bin/wp" https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x "$HOME/bin/wp"
WP-CLI is now installed in your hosting account. There is no need to rename the downloaded file, as it is saved directly as wp.
To run WP-CLI using the shorter wp command, the $HOME/bin directory must be included in your PATH environment variable.
Check your current PATH:
echo "$PATH"
If your home directory’s bin folder is not included, add the following line to your ~/.bash_profile file:
export PATH="$HOME/bin:$PATH"
Reload your profile:
source ~/.bash_profile
Depending on your shell configuration, you may need to add the PATH setting to a different startup file, such as ~/.bashrc.
Run:
wp --info
If the installation was successful, you should see information about your WP-CLI version, PHP version, and environment.
Navigate to your WordPress installation directory. For example:
cd ~/public_html
Useful WP-CLI commands include:
wp core version
wp plugin list
wp theme list
wp core verify-checksums
wp plugin update --all
wp cache flush
Important: We recommend backing up your website files and database before updating WordPress, plugins, or themes.
You can update WP-CLI using:
wp cli update
Alternatively, download the latest version again:
curl -fsSL -o "$HOME/bin/wp" https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x "$HOME/bin/wp"
wp: command not found — verify that $HOME/bin is included in your PATH. You can also run WP-CLI directly using $HOME/bin/wp --info.
PHP errors — check your command-line PHP version using php -v. The PHP version used by cPanel’s terminal may differ from the PHP version configured for your website.
WordPress installation not found — ensure you’re running commands from your WordPress installation directory, or specify the installation path using the --path parameter.
Official documentation: WP-CLI Installation Guide.