In this article, we will discuss how to install WP-CLI on Linux, whether you are using Ubuntu, Debian, CentOS, or others.
As a quick note, WP-CLI is the official command line tool for WordPress that allows you to interact with and manage WordPress using a CLI (Command Line Interface).
If you are interested in managing WordPress via CLI, you can start by installing WP-CLI by following the tutorial in this article.
How to Install WP-CLI on Linux
Let's get started. There are a few steps you need to follow for this installation process, including:
- Download the Phar Build
- Check if the Phar Build Can Be Used
- Make the Phar File Executable
- Try Running WP-CLI
1. Download the Phar Build
The first step you need to take is to download the Phar build, which can be done using wget or curl
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.pharor
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.pharOnce the download process is complete, you can check whether the Phar build you downloaded can be run or not.
2. Check if the Phar Build Can Be Used
To check, make sure PHP is already on your server (it should be, as it would be strange if you had installed WordPress but not PHP).
php wp-cli.phar --infoWhen the Phar file can be executed normally, you will get a result that looks something like this
3. Make the Phar File Executable
Even though it worked, it would certainly be very inconvenient if you had to use the command php wp-cli.phar {command} every time you use WP-CLI, so we need to make it so the command is simpler.
To do this, you need to make the Phar file executable and move it to a specific folder within your PATH, for example, with the following command:
chmod +x wp-cli.pharsudo mv wp-cli.phar /usr/local/bin/wpWhen successful, you will not get any output, so just proceed to the next step
4. Try Running WP-CLI
To test running WP-CLI, you can try checking the information for the WP-CLI installed on your server using the following command
wp --infoWhen all the processes are correct and successful, you will get a result that looks something like this
How was that, easy right? That is the quick and easy way to install WP-CLI on Linux, so you can later manage WordPress using the Command Line.
COMMENTS
Loading...