WordPress "WP-CLI" How to install and use

WordPress “WP-CLI” How to install and use

In this article I will explain how to install WP-CLI so that you can actually operate WordPress installed on the shared rental server “ACE01”.There are two installation methods, one is to download directly using the curl command, and the other is to transfer the WP-CLI executable file using the file manager function of “ACE01”. Select the method you like.

table of contents

Installation method using curl command Installation method using the file manager function WP-CLI operation check How to update WP-CLI Finally

1. How to install using the curl command

The curl command is a standard data transfer command that comes standard with many Unix operating systems. The curl command can also be executed from the command line of the shared rental server “ACE01”.I will explain how to download the WP-CLI executable file published on the Internet directly to the WordPress installation directory using the curl command.First, SSH to the server with a terminal such as Tera Term and move to the WordPress installation.cd ~ / html / <WordPress installation directory> /~ / html / < WordPress installation directory> / Next, execute the curl command by specifying the URL of the WP-CLI executable file published on the Internet.curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar- O Https : //Raw.Githubusercontent.Com/wp-cli/builds/gh-pages/phar/wp-cli.Phar Once the download is complete, a file called wp-cli.phar will be added to your WordPress installation directory. Let’s check if it is added with the ls command.ls -l - L This completes the WP-CLI installation.

2. Installation method using the file manager function

Next, I will explain how to install WP-CLI using the file manager function from the web control panel of the shared rental server “ACE01”. If you are unfamiliar with command operations or want to operate them visually, please try this method.First, download the WP-CLI executable file to your PC.Enter the following URL in the address bar of your web browser to access it, and the download will start. https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.pharAfter downloading, log in to the Web Control Panel and click “Public Site Settings”-> “FTP / File Management”-> “Secure File Manager” The file manager login screen will be displayed. Enter your login information by referring to the information below.

File manager login screen

Your domain name Open “Customer Information”-> “Program Path and Server Information” in the web control panel and display “Public Domain Name” (~ .ne.jp) FTP account FTP account name created in “FTP account settings” * If not created, create it in advance. password Password entered during “FTP account settings” Enter each information and click the login button to move to the file manager screen.File manager screen 1File manager screen 2Select the directory where you want to upload the file. Click the link on the screen to go to your WordPress installation directory.File manager screen 3After navigating to the WordPress installation directory, make sure that the path shown in the current directory is the path to your WordPress installation directory.Then upload the file. There is a place called ▼ Local at the bottom of the screen, so click the File 01: “Select File” button there and select the WP-CLI executable file (wp-cli.phar) you downloaded earlier. ..When you click the upload button, the file will be transferred to the WordPress installation directory of the shared rental server “ACE01”.

3. Confirmation of WP-CLI operation

Execute the wp –info command to check whether the WP-CLI was installed correctly in step 1 or 2.cd ~ / html / <WordPress installation directory> /~ / html / < WordPress installation directory> / Php – 7.1 Wp – Cli . Phar – Info If the PHP version or WP-CLI version is displayed as shown below, the operation check is successful.WP-CLI installation completeThis completes the WP-CLI installation.

4. How to update WP-CLI

The current version of WP-CLI is 2.3.0, as you can see in the result of executing the wp –info command in 3.When the version of WP-CLI is updated, you can update to the latest version by executing the wp cli update command .php-7.1 wp-cli.phar cli update- 7.1 Wp – Cli . Phar Cli Update Unlike WordPress itself, WP-CLI is not updated frequently, but once installed, you can easily update it by executing a command.Regarding the update of WordPress itself and the update of the theme plugin introduced in the previous article, if you do not update the version of WP-CLI, you can only update to the latest when the past WP-CLI was released.Therefore, please be sure to update WP-CLI to the latest version before updating WordPress itself or updating the theme plugin.

5. Finally

This time, I explained how to install and use WP-CLI.Installing WP-CLI is very easy, so please install it on your own WordPress and try it out.