WP-CLI (WordPress Command Line Interface) is a powerful tool that allows you to manage WordPress websites through the command line, simplifying tasks and saving time.
In this guide, we will walk you through the process of installing WP-CLI on a cPanel server with autocomplete support, making command execution quicker and more efficient.
Prerequisites:
Ensure you have the following:
- A server with cPanel installed
- SSH access to your server
Installation Steps:
Follow these steps to install WP-CLI with autocomplete on your cPanel server:
- Download WP-CLI:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- Make WP-CLI executable:
chmod +x wp-cli.phar
- Move WP-CLI to the bin directory:
mv wp-cli.phar /usr/local/bin/wp
- Download the autocomplete script:
wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
- Move the autocomplete script to the bash completion directory:
mv wp-completion.bash /etc/bash_completion.d/wp-completion.bash
- Add the bash completion directory to jailshell mounts:
echo "/etc/bash_completion.d" >> /var/cpanel/jailshell-additional-mounts
- Source the autocomplete script:
echo "source /etc/bash_completion.d/wp-completion.bash" >> /etc/profile.d/wpcli-autocomplete.sh
Testing WP-CLI Autocomplete
To test the WP-CLI autocomplete feature, either open a new SSH session or run:
source /etc/profile.d/wpcli-autocomplete.sh
Now, as you enter WP-CLI commands, you can enjoy autocompletion to simplify WordPress management through the command line.
This is how you can install WP-CLI on a cPanel server with autocomplete. If you need further assistance, feel free to contact our support team.
Need to access the command line through cPanel? Check out How to access the Web Server Command Line through cPanel