Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to install PHPUnit on my linux box running CentOS 5.8 and I'm getting a heap of problems.

I'm running PHP version 5.4.12 (Remi install).

The odd thing to note first is that I have what seems like two pear installations at both /usr/share/pear and /usr/share/php.

First I tried

pear install --alldeps php/PHPUnit

This gave me:

phpunit/PHPUnit requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.4.9
phpunit/Text_Template requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9
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_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2.0.5)
phpunit/PHP_Timer requires PEAR Installer (version >= 1.9.2), installed version is 1.4.9
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9
phpunit/PHPUnit_MockObject requires package "phpunit/Text_Template" (version >= 1.1.1)
phpunit/PHPUnit_MockObject can optionally use PHP extension "soap"
phpunit/PHP_Invoker requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9
phpunit/PHP_Invoker requires package "phpunit/PHP_Timer" (version >= 1.0.1)
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.4), installed version is 1.4.9
No valid packages found
install failed

My next course of action was to upgrade pear:

Skipping package "pear/PEAR", already installed as version 1.9.4
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
.........done: 30,318 bytes

Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Validate.php on line 486
ERROR: unable to unpack /tmp/tmp4Gb17e/Structures_Graph-1.0.4.tgz

What I notice here is that it says I have the latest version (1.9.4). pear version tells me otherwise (1.4.9). I'm not sure what the issue is with the tar file error.

Next I run yum remove php-pear so I can try and reinstall with the latest:

Running Transaction
  Erasing        : php-pear                                                                                                                                                                                                              1/1

Removed:
  php-pear.noarch 1:1.4.9-8.el5

Complete!

I've now reinstalled pear using sudo yum install php-pear, and followed the instructions listed here , but now I'm getting the same error as before when I try to install PHPUnit (error with PEAR version). Why when I install pear manually is it not giving me the most up to date package?

I'm getting lost now, and it seems that I have two PEAR installations floating about, and I'm not sure how to approach purging them and starting with a clean slate. Would anyone have any idea how to rectify this situation? Is it that I should recompile PHP altogether and start afresh?

Thanks for any help.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Ok, so I got this working in the end by downloading and installing PEAR manually:

wget http://pear.php.net/go-pear.phar
php go-pear.php

What I didn't realise was that PEAR was probably too outdated to do this for itself (thanks to this post)

This then allowed me to install PHPUnit.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.