Search code examples
phpunitwamppear

Can't install PHPUnit with PEAR 1.9.1


This appears to be an issue known with earlier versions of PEAR, unfortunately the solutions did not work for me.

My setup: Win7, 32bit. PHP directory: c:\Program Files\PHP. All commands are run from a console with admin rights.

I have installed the latest (on 2012.02.17) version of PEAR available. Using the go-pear.phar it came as 1.9.1. Then I tried to install PHPUnit by running pear install pear.phpunit.de/PHPUnit and got the following errors:

    phpunit/PHPUnit requires PEAR Installer (version >= 1.9.4), installed version is
 1.9.1
phpunit/PHPUnit requires package "channel://pear.symfony-project.com/YAML" (vers
ion >= 1.0.2)
phpunit/PHPUnit can optionally use package "phpunit/PHP_Invoker" (version >= 1.1
.0)
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed vers
ion is 1.9.1
phpunit/Text_Template requires PEAR Installer (version >= 1.9.4), installed vers
ion is 1.9.1
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.4), installed v
ersion is 1.9.1
phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.
3.0)
phpunit/PHP_CodeCoverage requires package "phpunit/Text_Template" (version >= 1.
1.1)
phpunit/PHP_Timer requires PEAR Installer (version >= 1.9.2), installed version
is 1.9.1
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.4), installed
 version is 1.9.1
phpunit/PHPUnit_MockObject requires package "phpunit/Text_Template" (version >=
1.1.1)
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.4), installed ve
rsion is 1.9.1
No valid packages found
install failed

I have tried upgrading PEAR to 1.9.4 by running pear upgrade pear, which results in message

pear/pear is already installed and is the same as the released version 1.9.4
upgrade failed

Forcing the upgrade with -f key works, packages with 1.9.4 in file names are downloaded and successfull install is reported, but pear -V still returns 1.9.1. PHPUnit install still fails. Please help, I am losing my mind.


Solution

  • An older version of PEAR was at c:\PHP, which was referenced in the PATH. PEAR saw this version first and ignored the newer one. The reference to the folder with the older version has to be removed from the PATH variable before installing PHPUnit. I thank David Harkness for the clue.