WP-CLI is a command line tool for WordPress. With this you can manage multiple WordPress installations without logging in through your Web browser. With WP-CLI you can also install additional scripts in order to further automate your WordPress installations.
Installation
You need to be logged into your Webhosting via SSH in order to complete the following steps.
Here you will find instructions on how to set up and use SSH.
You can use curl to download the latest version:
Then you need to make the file executable:
chmod +x wp-cli.phar
Then create the bin folder:
mkdir ~/bin
And move the file:
mv wp-cli.phar ~/bin/wp
In order to use WP-CLI in your Webhosting, you need to adjust your Bash profile:
vim .profile
Insert this line anywhere in the file:
export PATH=$PATH:$HOME/bin
To save and close the file, press the Escape key, then enter ":wq" (without the quotation marks) and press Enter.
:wq
Then, in order for the changes to take effect, you need to reload the Bash profile:
source ~/.profile
You can now test WP-CLI with this command:
wp --info
If everything is correctly configured, you should get something like this:
OS: FreeBSD 12.3-RELEASE-p7 FreeBSD 12.3-RELEASE-p7 releng/12.3-n234209-e134a96fd6f HOSTPOINT amd64
Shell: /usr/local/bin/bash
PHP binary: /usr/local/php74/bin/php
PHP version: 7.4.33
php.ini used: /usr/local/php74/etc/php.ini
MySQL binary: /usr/local/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.3.37-MariaDB, for FreeBSD12.3 (amd64) using readline 5.1
SQL modes:
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/USER/bin
WP-CLI packages dir:
WP-CLI cache dir: /home/USER/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.7.1
For support requests please use this form instead.