2.13.1.2.4. Installing WP-CLI
WP-CLI Is the official console utility for working with a WordPress site.
- Connect to hosting via SSH.
- Download the phar archive using curl:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- 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
- Set the file to execute permissions by running the command:
chmod +x wp-cli.phar
- For convenience, create an 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 Team wp
php ~/wp-cli.phar
- 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>