How to install wp-cli on centos 7
Minimum requirements for wp-cli
- UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment
- PHP 5.3.29 or later
- WordPress 3.7 or later
Read Also: How to install wordpress
After the minimum requirements, we will download wp-cli.phar file using curl or wget:
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Now, check the downloaded file is working with the following command:
$ php wp-cli.phar --info
Now we have downloaded and checked wp-cli.phar. Now we will change the permissions to executable and move it to /usr/local/bin or /usr/bin that depends on our path. We will rename the file to wp so it would be easy to use. For me the is /usr/bin:
$ chmod +x wp-cli.phar
$ mv wp-cli.phar /usr/bin/wp
Once you have moved the file to the /usr/bin now let’s check it again:
$ wp --info PHP binary: /usr/bin/php PHP version: 5.6.31 php.ini used: /etc/php.ini WP-CLI root dir: phar://wp-cli.phar WP-CLI vendor dir: phar://wp-cli.phar/vendor WP_CLI phar path: /root WP-CLI packages dir: WP-CLI global config: WP-CLI project config: WP-CLI version: 1.3.0
Now we have installed wp-cli now it’s time to work with it.
$ wp cli version
The above command will show you the version of the wp cli. If you want to check the update of wp cli uses the following command.
$ wp cli check-update
Success: WP-CLI is the latest version.
The wp cli is already up to date. If there will be any update you can use the following command to update it or you can repeat the installation steps:
$ wp cli update
Now navigate to WordPress directory and execute the following command to check the version of the WordPress.
$ cd /var/www/html
$ wp core version
The version if wordpress core is 4.8.1.
If you want to update the WordPress core version using wp cli execute the following command:
$ wp core update
To list the installed plugins:
$ wp plugin list
To update the all the plugins, execute the following command:
$ wp plugin update --all
You can do lot of stuff with wp cli and to see the available options execute the following command:
$ wp --help
You can also go to wp-cli.org official website for more information.