“Class ‘Phar’ not found” error setting up WP-CLI with Cygwin

You are missing the Phar extension or it’s not enabled. Which version of PHP are you actually running? Check it with php --version.

The Phar extension is bundled with PHP as of PHP version 5.3.0, and enabled by default.

See https://www.php.net/manual/en/phar.installation.php.

Your best bet is to upgrade PHP to at least PHP 7.1. Alternatively follow other guides around here to either get and enable Phar, or calling WP-CLI with a different PHP version.

See PHP: Class ‘Phar’ not found.


Finally this one may turn out as a big helper as well: Cygwin and Xampp, wrong PHP is being used. To have Cygwin use XAMPP’s PHP instead its own call the following command every time you restart Cygwin or add it to its ~/.bashrc or ~/.bash_profile to be permanent.

export PATH=/cygdrive/c/xampp/php:$PATH