newcomer student
newcomer student

Reputation: 95

composer update class phar not found

my version is 7.1.1

i'm trying this code to install react/zmq:

$ composer require react/zmq

but i saw this error:

 PHP Fatal error:  Uncaught Error: Class 'Phar' not found in /cygdrive/c/ProgramData/ComposerSetup/bin/composer.phar:23
Stack trace:
#0 {main}
  thrown in /cygdrive/c/ProgramData/ComposerSetup/bin/composer.phar on line 23

what's the problem?

Upvotes: 1

Views: 8735

Answers (2)

davidbwire
davidbwire

Reputation: 96

If you're using Ubuntu the Phar class does not seem to be included in the php cli distribution that comes preinstalled.

Locate the php executable file. It's likely to be on /usr/bin/

cd /usr/bin

Try and see if you have php files

ls -l | grep php

You might see php and php7.1 listed. If that's the case

sudo mv php php-old
sudo mv php7.1 php

Upvotes: 0

maximkou
maximkou

Reputation: 5332

  1. Check, if the Phar extension is installed/enabled.
  2. If installed, and not enabled - enable it in php.ini, or run command like this: php -d extension=phar.so {path_to_composer_bin} require react/zmq

Upvotes: 2

Related Questions