Guide to install WP-CLI to manage wordpress blog on SSH?

Philippe Gaucher

Well-known member
Joined
Jul 27, 2016
Messages
149
Best answers
0
Ratings
6 1
Points
18
#1
Can you guys guide me to install WP-CLI to manage my wordpress blog on SSH? I heard that using WP-CLI will make my work with WordPress easier and faster, is that true?
 

David Beroff

Well-known member
Joined
Jun 14, 2016
Messages
948
Best answers
0
Ratings
75 1
Points
28
#2
WP-CLI is a handy tool for managing wordpress blogs on SHH via command line. We can do a lot of work without login to the wordpress admin anymore. You can update plugins, themes, install wordpress multisite, backup, restore database, install new Wordpress...etc

Command to install WP-CLI

Download phar file:

Code:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Check out the phar file

Code:
 php wp-cli.phar --info
Then install:

Code:
chmod + x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp
Command to update WP-CLI

Code:
wp cli update
Check settings

Use the following command to check:
Code:
wp --info
Result:

Code:
PHP binary:/usr/bin/php
PHP version:5.6.32
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.4.0
Some commands are often used. Before running wp-cli, you need to cd to the root directory of your domain.

Code:
cd /home/example.com/public_html
If you run wp-cli with root user, you must add -allow-root to the end of your command, then run wp-cli offline.

For example:

Code:
wp plugin status --allow-root
First, my example is a way to install wordpress with wp-cli quickly.
Code:
cd /home/example.com/public_html
wget https://wordpress.org/latest.zip
unzip -q latest.zip
mv wordpress / * ./
rm -rf wordpress
rm -rf latest.zip
chown -R nginx:nginx /home/example.com/public_html/
wp core config --dbname = dataname --dbuser = username --dbpass = password --allow-root
wp core install --url = "http://example.com" --title = "website_name" --admin_user = "admin" --admin_password = "password" --admin_email = "[email protected]" allow-root
This way above is to download and install a new blog. Very fast, right?

Check plugin status:

Code:
wp plugin status
Update all plugins:

Code:
wp plugin update --all
Find a plugin:

Code:
wp plugin bulletproof search
Plug-in installation:

Code:
wp plugin install bulletproof-security
Acctivated a plugin:

Code:
wp plugin activate bulletproof-security
Once installed, just activate with command:

Code:
wp plugin install bulletproof-security --activate
Check themes status:

Code:
wp theme status
Install and activate the theme:

Code:
wp theme install theme_name --activate
Upgrade wordpress code:

Code:
wp core update
Update database after upgrade code:

Code:
wp core update-db
Database backup:

Code:
wp db export> file_name.sql
Create User:

Code:
wp user create yourname [email protected] --role=author
Hope it helps!
 
Last edited:
Older Threads
Replies
13
Views
343
Replies
3
Views
124
Replies
3
Views
209
Replies
0
Views
101
Newer Threads
Replies
5
Views
228
Replies
2
Views
100
Replies
0
Views
109
Latest Threads
Replies
1
Views
2
Replies
0
Views
9
Replies
0
Views
9
Replies
2
Views
38
Replies
4
Views
22
Recommended Threads
Similar Threads

Latest postsNew threads

Latest Hosting OffersNew Reviews

Sponsors

Latest Blog ArticlesMost Viewed Threads

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top