سؤال

I am trying of install the dependency manager for php "composer", but "composer" needs the extension "phar". I've realized php6 comes with phar by default, but is disabled and not necessary in order to execute "phar" files.

When I try execute "composer.phar" (in the cmd: php composer.phar) it throws the error:

Fatal error: Class 'Phar' not found in composer.phar on line 13.

If I try to execute the Composer installer, "installer.php" (in the cmd: php installer.php) throws this error:

Some settings on you machine make composer unable to work properly. Make sure that you fix the issues listed below and run this script again:

The phar extension is missing. How can I fix this?

Should I install it or recompile php without --disable-phar I am using appserv 2.6.4 (apache 2.2, php6, mysql 4).

هل كانت مفيدة؟

المحلول

You really shouldn't use cutting edge theoretical software. PHP6 doesn't actually exist. Downgrading to a more realistic version of appserv would solve your problem. But if you insist on using 2.6.4, you should do the following:

  • check that phar.so exists in the php extensions directory. If not, you need to install that extension.
  • if it exists, check if it's listed in php.ini as extension=phar.so. If it's not, add that line.
  • if it is, check that it's listed in the php.ini that command line PHP uses, too. Command line PHP and web PHP sometimes use different php.ini files, and while one might have phar.so activated, the other might not.
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top