Using WP-CLI in XAMPP for Linux

WP-CLI or WordPress Command Line Interface is used to manage sites without the need of accessing the website through a browser. Here is a quick instruction on how to install WP-CLI in XAMPP for GNU/Linux.

Getting Started

Download WP-CLI, you can use curl, or wget commands to download the wp-cli.phar file.

$ curl -O


$ wget

Next, is to check whether the downloaded file works or not, by running the following command:

$ php wp-cli.phar --info

You’ll notice the following output:

$ php wp-cli.phar --info
The program 'php' can be found in the following packages:
 * php7.0-cli
 * hhvm
Try: sudo apt install <selected package>

This is due to the missing PHP package, XAMPP is used to ease the installing of such packages for a quick development server setup, installing PHP package isn’t an ideal solution, as XAMPP already includes it. What you need to do is define the PATH variable.

Defining PATH Variable

When you type the following in your shell, you’ll notice your existing path from which the executable files are called:

$ echo $PATH

PATH variable lists all the paths of the executable directory from where the shell will try to execute a particular command.

To add the XAMPPs PHP directory, you’ll need to define the following rules in the .profile file located in your home directory. The rules will be as follows:
Continue reading “Using WP-CLI in XAMPP for Linux”