We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.13.1.2.4. Installing WP-CLI

WP-CLI Is the official console utility for working with a WordPress site.

To install WP-CLI do the following:

  1. Connect to hosting via SSH.
  2. Download the phar archive using curl:
    curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  3. Verify that the file is working properly by running the command:
    php wp-cli.phar --info

    As a result, something like the following should be displayed:

    OS:     Linux
    Shell:  /bin/bash
    PHP binary:     /usr/local/php56/bin/php
    PHP version:    5.6.40
    php.ini used:
    WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir:      phar://wp-cli.phar/vendor
    WP_CLI phar path:       /home/example
    WP-CLI packages dir:
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 2.1.0
  4. Set the file to execute permissions by running the command:
    chmod +x wp-cli.phar
  5. For convenience, create alias:
    Run the commands in turn:
    echo "alias wp='php ~/wp-cli.phar'" >> ~/.bashrc
    source ~/.bashrc
    Add an alias through the section "Linux configuration»:
    Alias Command
    wp php ~/wp-cli.phar
  6. Check if the alias works by running the command:
    wp --info

    The result should be the same as in paragraph 3.

To run the utility in the console, use:

wp <required arguments>