Knowledge Base

How Can We Help?

Using WP-CLI with WebHostingPeople shared hosting

You are here:

WP-CLI is offered on Linux Plans for WebHostingPeople shared internet hosting. It isn’t accessible on ASP.internet plans.

To make use of WP-cli the put in location have to be referred to as. WP-CLI is put in at /choose/wp

This path may be referred to as by scripts, or cron and naturally SSH. To allow SSH on a shared internet hosting account please contact assist.

WP-CLI can’t run with suhosin, which is put in by default – so the primary command to run is to set the trail of PHP.

export PATH=/choose/cpanel/ea-php71/root/usr/bin:$PATH

As soon as accomplished /choose/wp may be referred to as. Begin with the –data swap. For instance

[wptest@webhosting2024 ~]$ export PATH=/choose/cpanel/ea-php71/root/usr/bin:$PATH
[wptest@webhosting2024 ~]$ cd public_html
[wptest@webhosting2024 public_html]$ /choose/wp –info
OS: Linux 3.10.0-714.10.2.lve1.5.17.el7.x86_64 #1 SMP Mon Apr 30 13:06:32 EDT 2018 x86_64
Shell: /bin/bash
PHP binary: /choose/cpanel/ea-php71/root/usr/bin/php
PHP model: 7.1.18
php.ini used: /choose/cpanel/ea-php71/root/and many others/php.ini
WP-CLI root dir: phar://wp-cli.phar
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /residence/wptest/public_html
WP-CLI packages dir:
WP-CLI international config:
WP-CLI venture config:
WP-CLI model: 1.5.1

 

The primary command units the trail to php to 7.1 with out suhosin. The second command strikes into the public_html folder the place WordPress is put in. Lastly the final command runs wp-cli with the information swap. If nothing returns there may be an error that will probably be displayed usually in the identical folder underneath the file error_log.

WP cli has many choices. It might probably confirm checksums, replace wordpress, plugins, themes, disable plugins and extra.

A number of instructions may be positioned on the identical line. For instance if you wish to confirm checksums, replace plugins and themes

export PATH=/choose/cpanel/ea-php71/root/usr/bin:$PATH; /choose/wp core verify-checksums; /choose/wp core replace; /choose/wp plugin replace –all

 

The above units the php path, verifies checksums, updates wordpress and updates plugins.

 

An instance output would seem like

 

Warning: File shouldn’t exist: wp-admin/error_log
Success: WordPress set up verifies in opposition to checksums.
Success: WordPress is updated.
Enabling Upkeep mode…
Downloading replace from https://downloads.wordpress.org/plugin/akismet.4.0.7.zip…
Unpacking the replace…
Putting in the most recent model…
Eradicating the previous model of the plugin…
Plugin up to date efficiently.
Downloading replace from https://downloads.wordpress.org/plugin/loginizer.1.4.0.zip…
Unpacking the replace…
Putting in the most recent model…
Eradicating the previous model of the plugin…
Plugin up to date efficiently.
Disabling Upkeep mode…
+———–+————-+————-+———+
| title | old_version | new_version | standing |
+———–+————-+————-+———+
| akismet | 4.0.3 | 4.0.7 | Up to date |
| loginizer | 1.3.9 | 1.4.0 | Up to date |
+———–+————-+————-+———+
Success: Up to date 2 of two plugins.

Observe: Warning: File shouldn’t exist: wp-admin/error_log – this file is just not a part of a wordpress set up. On this case that is created by php. Ought to PHP information present that ought to not exist, they need to be inspected because it may very well be hidden malware.

 

You may change themes as properly. For instance

 

[wptest@webhosting2024 public_html]$ /choose/wp theme record
+—————–+———-+———–+———+
| title | standing | replace | model |
+—————–+———-+———–+———+
| twentyfifteen | inactive | accessible | 1.9 |
| twentyseventeen | energetic | accessible | 1.5 |
| twentysixteen | inactive | accessible | 1.4 |
+—————–+———-+———–+———+
[wptest@webhosting2024 public_html]$ /choose/wp theme activate twentysixteen
Success: Switched to ‘Twenty Sixteen’ theme.
[wptest@webhosting2024 public_html]$ /choose/wp theme record
+—————–+———-+———–+———+
| title | standing | replace | model |
+—————–+———-+———–+———+
| twentyfifteen | inactive | accessible | 1.9 |
| twentyseventeen | inactive | accessible | 1.5 |
| twentysixteen | energetic | accessible | 1.4 |
+—————–+———-+———–+———+

Or replace themes

[wptest@webhosting2024 public_html]$ /choose/wp theme replace –all
Enabling Upkeep mode…
Downloading replace from https://downloads.wordpress.org/theme/twentyfifteen.2.0.zip…
Unpacking the replace…
Putting in the most recent model…
Eradicating the previous model of the theme…
Theme up to date efficiently.
Downloading replace from https://downloads.wordpress.org/theme/twentyseventeen.1.6.zip…
Unpacking the replace…
Putting in the most recent model…
Eradicating the previous model of the theme…
Theme up to date efficiently.
Downloading replace from https://downloads.wordpress.org/theme/twentysixteen.1.5.zip…
Unpacking the replace…
Putting in the most recent model…
Eradicating the previous model of the theme…
Theme up to date efficiently.
Disabling Upkeep mode…
+—————–+————-+————-+———+
| title | old_version | new_version | standing |
+—————–+————-+————-+———+
| twentyfifteen | 1.9 | 2.0 | Up to date |
| twentyseventeen | 1.5 | 1.6 | Up to date |
| twentysixteen | 1.4 | 1.5 | Up to date |
+—————–+————-+————-+———+
Success: Up to date Three of three themes.

 

WP-CLI may be very highly effective and affords many alternative sub instructions

 

SUBCOMMANDS

cache Provides, removes, fetches, and flushes the WP Object Cache object.
cap Provides, removes, and lists capabilities of a person position.
cli Evaluate present WP-CLI data, test for updates, or see outlined aliases.
remark Creates, updates, deletes, and moderates feedback.
config Generates and reads the wp-config.php file.
core Downloads, installs, updates, and manages a WordPress set up.
cron Assessments, runs, and deletes WP-Cron occasions; manages WP-Cron schedules.
db Performs fundamental database operations utilizing credentials saved in wp-config.php.
embed Inspects oEmbed suppliers, clears embed cache, and extra.
eval Executes arbitrary PHP code.
eval-file Masses and executes a PHP file.
export Exports WordPress content material to a WXR file.
assist Get assistance on WP-CLI, or on a particular command.
import Imports content material from a given WXR file.
language Installs, prompts, and manages language packs.
media Imports information as attachments, regenerates thumbnails, or lists registered picture sizes.
menu Lists, creates, assigns, and deletes the energetic theme’s navigation menus.
community Carry out network-wide operations.
possibility Retrieves and units web site choices, together with plugin and WordPress settings.
package deal Lists, installs, and removes WP-CLI packages.
plugin Manages plugins, together with installs, activations, and updates.
publish Manages posts, content material, and meta.
post-type Retrieves particulars on the positioning’s registered publish sorts.
rewrite Lists or flushes the positioning’s rewrite guidelines, updates the permalink construction.
position Manages person roles, together with creating new roles and resetting to defaults.
scaffold Generates code for publish sorts, taxonomies, plugins, little one themes, and many others.
search-replace Searches/replaces strings within the database.
server Launches PHP’s built-in net server for a particular WordPress set up.
shell Opens an interactive PHP console for operating and testing PHP code.
sidebar Lists registered sidebars.
web site Creates, deletes, empties, moderates, and lists a number of websites on a multisite set up.
super-admin Lists, provides, or removes tremendous admin customers on a multisite set up.
taxonomy Retrieves details about registered taxonomies.
time period Manages taxonomy phrases and time period meta, with create, delete, and record instructions.
theme Manages themes, together with installs, activations, and updates.
transient Provides, will get, and deletes entries within the WordPress Transient Cache.
person Manages customers, together with their roles, capabilities, and meta.
widget Manages widgets, together with including and shifting them inside sidebars.

 

Take pleasure in

 

Leave a Comment