I'm trying to install the WP-CLI tools as described here using Cygwin, which the guide claims is supported.
When doing:
cd /XAMPP/htdocs
curl -O .phar
php wp-cli.phar --info
It fails with the following error:
PHP Fatal error: Uncaught Error: Class 'Phar' not found in /cygdrive/b/Users/User/Desktop/XAMPP/htdocs/wp-cli.phar:3 Stack trace: #0 {main} thrown in /cygdrive/b/Users/User/Desktop/XAMPP/htdocs/wp-cli.phar on line 3
What's causing this error, and how can I successfully get WP-CLI running under Cygwin?
I'm trying to install the WP-CLI tools as described here using Cygwin, which the guide claims is supported.
When doing:
cd /XAMPP/htdocs
curl -O https://raw.githubusercontent/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
It fails with the following error:
PHP Fatal error: Uncaught Error: Class 'Phar' not found in /cygdrive/b/Users/User/Desktop/XAMPP/htdocs/wp-cli.phar:3 Stack trace: #0 {main} thrown in /cygdrive/b/Users/User/Desktop/XAMPP/htdocs/wp-cli.phar on line 3
What's causing this error, and how can I successfully get WP-CLI running under Cygwin?
Share Improve this question edited Jun 17, 2019 at 1:41 Hashim Aziz asked Jun 14, 2019 at 22:15 Hashim AzizHashim Aziz 2977 silver badges19 bronze badges 1- 1 Install Phar. php/manual/en/phar.setup.php – MikeNGarrett Commented Jun 14, 2019 at 22:36
1 Answer
Reset to default 3You 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/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