WP-CLI is a powerful command-line tool for managing WordPress installations. Here’s a step-by-step guide to installing WP-CLI on a cPanel account for a specific user.
Prerequisites
- SSH access to your cPanel account
- Basic knowledge of command-line operations
- A WordPress installation on your cPanel account
Step-by-Step Guide
1. Login to cPanel:
Access your cPanel account using your credentials.
2. Enable SSH Access:
- Navigate to the “Security” section and click on “SSH Access”.
- Follow the instructions to enable SSH access if it’s not already enabled.
3. Access Your Account via SSH:
- Open your terminal or command prompt.
- Connect to your cPanel account using SSH:
ssh [email protected]
- Replace yourusername with your cPanel username and yourdomain.com with your domain.
4. Download WP-CLI:
- Once logged in via SSH, download the WP-CLI phar file:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
5. Make the WP-CLI Executable:
- Change the permissions of the downloaded file to make it executable:
chmod +x wp-cli.phar
6. Move WP-CLI to a Global Location:
- Move the executable file to a directory that’s in your PATH, such as /usr/local/bin:
sudo mv wp-cli.phar /usr/local/bin/wp
7. Verify Installation:
- Check if WP-CLI is installed correctly by running:
wp --info
You should see information about your WP-CLI installation.
8. Configure WP-CLI (Optional):
- If you want to use WP-CLI with specific WordPress installations, navigate to the directory of your WordPress installation:
cd /home/yourusername/public_html/yourwordpresssite
Replace yourusername with your cPanel username and yourwordpresssite with your WordPress directory.
9. Running WP-CLI Commands:
- You can now run WP-CLI commands to manage your WordPress site. For example:
wp plugin list
- This command will list all installed plugins on your WordPress site.
Troubleshooting
- Ensure that you have the necessary permissions to install and move files in your cPanel account.
- If you encounter permission issues, consider contacting your hosting provider for assistance.
Conclusion
By following these steps, you can successfully install and use WP-CLI on your cPanel account, allowing you to manage your WordPress installations more efficiently via the command line.