Archiwa tagu: xampp

Installing WP-CLI on XAMPP for Windows

Globally installing the PHAR involves the same procedure as manually installing PHPUnit or Composer on Windows.

1. Install XAMPP for Windows into e.g., C:\xampp

2. Append ;C:\xampp\php to your PATH environment variable
( Start –> Control Panel –> System –> Advanced System Settings –> Environment Variables )

3. Download wp-cli.phar and save the file as C:\xampp\php\wp-cli.phar

4. Open a command line (e.g., press Windows+R » type cmd » ENTER)

5. Create a wrapping batch script (results in C:\xampp\php\wp.cmd):

C:\Users\username>  cd C:\xampp\php
C:\xampp\php>  echo @php "%~dp0wp-cli.phar" %* > wp.cmd
C:\xampp\php>  exit

6. Open a new command line and confirm that you can execute WP-CLI from any path:

C:\Users\username>  wp --info
PHP binary:            C:\xampp\php\php.exe
PHP version:           7.0.1
php.ini used:          C:\xampp\php\php.ini
WP-CLI root dir:       phar://wp-cli.phar
WP-CLI packages dir:   /.wp-cli/packages/
WP-CLI global config:  
WP-CLI project config: 
WP-CLI version:        0.23.1

7.(optional). For MingW32 (that comes with Git for Windows) shell environment, save the file as wp (in C:\xampp\php ;without .phar extension)

bash: wp: command not found
bash: phpunit: command not found
bash: phpcs: command not found