Add WP CLI globally for all users — CyberPanel - WebHosting Control Panel for OpenLiteSpeed
CyberHosting

Add WP CLI globally for all users

edited October 2019 in Tutorials
If you haven't heard of it the wp cli is amazing for resetting passwords managing plugins updates and so much more.

https://wp-cli.org/
https://make.wordpress.org/cli/handbook/quick-start/

Steps one by one.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
nano /etc/profile.d/add_user_local_bin.sh
PATH=$PATH:/usr/local/bin

Oneliner.
wget -O /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; chmod +x /usr/local/bin/wp; touch /etc/profile.d/add_user_local_bin.sh; echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile.d/add_user_local_bin.sh;

How it looks.
[email protected]:~# wget -O /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar; chmod +x /usr/local/bin/wp; touch /etc/profile.d/add_user_local_bin.sh; echo 'PATH=$PATH:/usr/local/bin' >> /etc/profile.d/add_user_local_bin.sh;
--2019-10-09 23:36:44-- https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5542314 (5.3M) [application/octet-stream]
Saving to: ‘/usr/local/bin/wp’

/usr/local/bin/wp 100%[=============================================================================>] 5.29M 31.0MB/s in 0.2s

2019-10-09 23:36:45 (31.0 MB/s) - ‘/usr/local/bin/wp’ saved [5542314/5542314]

[email protected]:~#


Then login as a user
su - user

Then you should be able to use wp CLI commands like.

[[email protected]:~/public_html]$ wp core version
5.2.3
[[email protected]:~/public_html]$ wp plugin list
+-------------------------+----------+-----------+---------+
| name | status | update | version |
+-------------------------+----------+-----------+---------+
| cmb2 | active | none | 2.6.0 |
| disable-comments | active | none | 1.10.2 |
| display-posts-shortcode | active | none | 3.0.2 |
| litespeed-cache | active | none | 2.9.8.6 |
| minify-html-markup | inactive | none | 1.99 |
| redux-framework | active | none | 3.6.15 |
| whattheserver-plugin | active | none | |
| sucuri-scanner | active | none | 1.8.21 |
| virtusky-core | active | none | 1.0 |
| w3-total-cache | inactive | none | 0.10.1 |
| wordfence | inactive | none | 7.4.0 |
| wp-geshi-highlight | active | none | 1.4.1 |
| js_composer | active | available | 5.6 |
| wordpress-seo | active | none | 12.2 |
| advanced-cache.php | dropin | none | |
+-------------------------+----------+-----------+---------+
[[email protected]:~/public_html]$


Resources.
https://unix.stackexchange.com/questions/352520/how-do-i-install-wp-cli-for-all-users-on-centos-7
Tagged:
Tagged:
Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!