WP-CLI, Cpanel 1

How to install WP-CLI on a cPanel server with autocomplete


Introduction

WP-CLI (WordPress Command Line Interface) is a powerful tool that allows you to manage your WordPress websites through the command line. It can save you time and make various WordPress tasks more efficient. In this tutorial, we will guide you through the process of installing WP-CLI on a cPanel server with autocomplete, which enhances the CLI experience.

Prerequisites

Before you begin, make sure you have the following:

  • A cPanel-based server
  • SSH access to your server

Installation Steps

Follow these steps to install WP-CLI with autocomplete on your cPanel server:

  1. Download WP-CLI:
    # curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  2. Make WP-CLI executable:
    # chmod +x wp-cli.phar
  3. Move WP-CLI to the bin directory:
    # mv wp-cli.phar /usr/local/bin/wp
  4. Download autocomplete script:
    # wget https://raw.githubusercontent.com/wp-cli/wp-cli/master/utils/wp-completion.bash
  5. Move autocomplete script to the bash completion directory:
    # mv wp-completion.bash /etc/bash_completion.d/wp-completion.bash
  6. Add the bash completion directory to jailshell mounts:
    # echo "/etc/bash_completion.d" >> /var/cpanel/jailshell-additional-mounts
  7. Source the autocomplete script:
    # echo "source /etc/bash_completion.d/wp-completion.bash" >> /etc/profile.d/wpcli-autocomplete.sh

Testing WP-CLI Autocomplete

After completing the installation, you can test WP-CLI autocomplete by opening a new SSH session or running the following command:

# source /etc/profile.d/wpcli-autocomplete.sh

Now, when you use WP-CLI commands, you can enjoy the convenience of autocompletion, making it easier to manage your WordPress websites via the command line.

Conclusion

Installing WP-CLI with autocomplete on your cPanel server can streamline your WordPress management tasks and boost your productivity. With autocompletion enabled, you can efficiently navigate and execute WP-CLI commands, making WordPress maintenance a breeze.

Thank you for reading our guide on installing WP-CLI with autocomplete on a cPanel server. We hope this tutorial has been helpful in enhancing your WordPress management experience through the command line.


Was this answer helpful?

One email a month. Endless business benefits.

Don't miss out on WMTWWFY — the newsletter that keeps your website fast, safe, and visible.

« Back
Spinner
aluminium-anthropoid Security Check