wp cli - "Class 'Phar' not found" error setting up WP-CLI with Cygwin

I'm trying to install the WP-CLI tools as described here using Cygwin, which the guide claims is supported.When doi

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
Add a comment  | 

1 Answer 1

Reset to default 3

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/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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745396351a4625896.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信