Introduction
WP-CLI (WordPress Command Line Interface) is a powerful tool for managing WordPress sites directly from the terminal. It simplifies developer workflows for tasks like creating new WordPress installations, managing language packs, modifying user role permissions, and much more.
This guide walks you through installing WP-CLI using cPanel.
Installation Steps
Log in to your server’s cPanel and navigate to Advanced → Terminal.
1. Navigate to the root directory:
cd ~
2. Create a /bin
directory (if missing):
mkdir -p ~/bin
3. Download WP-CLI. This fetches the latest WP-CLI build and saves it as an executable file (wp
):
curl -o ~/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
4. Set execute permissions:
chmod +x ~/bin/wp
5. Verify Installation. Expected output: WP-CLI version, PHP/OS info, and global config paths:
wp --info
Troubleshooting
If you manage multiple sites or encounter errors: Specify the WordPress installation path explicitly:
wp --path=/home/site.com --info
/home
– is your server’s root (often/home/clientname
)./site.com
– is your WordPress directory (e.g.,/public_html
,/wp-app
, etc.).
Why This Matters
- Efficiency: Execute WordPress tasks 10x faster than via GUI.
- Automation: Integrate with deployment scripts (e.g., Git hooks).
- Debugging: Access core commands like
wp config list
orwp cron event run
.
For advanced usage, refer to the official WP-CLI handbook.