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.

Oleg Ishenko
  • 2,243
  • 1
  • 15
  • 16
  • It sounds like the PEAR that's running is not in the same location as the one being installed. So PEAR 1.9.1 runs, sees 1.9.4 on disk, overwrites it with 1.9.4, but it has no effect on what gets run the next time. Post the result of `pear config-show` and `echo %PATH%`. – David Harkness Feb 17 '12 at 23:04
  • Thank you David, the problem was indeed with PATH. I had the older 1.9.1 version of PEAR at c:\PHP, which was in the PATH. Once removed the PHPUnit install completed successfully. – Oleg Ishenko Feb 20 '12 at 09:47
  • See http://stackoverflow.com/questions/6596316/cant-install-phpunit-via-pear-requires-pear-installer-1-9-2-cant-upgrade/6596669#6596669 – cweiske Mar 01 '12 at 21:07

2 Answers2

0

Are you sure you are running the cmd/powershell with super user privileges? It has happened to me that if I don't the packages are successfully downloaded but not installed.

markdrake
  • 624
  • 7
  • 12
  • Yes, I've run into problems with privileges earlier on and started the console again "As administrator". Shouldn't have installed PHP into Program files in the first place, but it is too late now. I am using the regular cmd console, and you've mentioned powershell, does it make difference in my case? – Oleg Ishenko Feb 17 '12 at 16:56
0

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.

Oleg Ishenko
  • 2,243
  • 1
  • 15
  • 16