Installing PHPUnit on CentOS 5.9

I recently had to install PHPUnit on a CentOS 5.9 system.  This turned out to be a little more complicated than I had anticipated, so I wrote down the procedure in case I had to do it again. Here are my notes:
1. Install php53 packages, not php (php packages install the old 4.x series)
2. Install PEAR, PHP’s component management system.  Here is the complete Yum log for a PEAR installation:

Jun 03 22:49:56 Installed: php53-common-5.3.3-13.el5_8.x86_64
Jun 03 22:49:57 Installed: php53-cli-5.3.3-13.el5_8.x86_64
Jun 03 22:49:58 Installed: php53-5.3.3-13.el5_8.x86_64
Jun 03 22:51:24 Installed: php53-devel-5.3.3-13.el5_8.x86_64
Jun 03 22:51:25 Installed: 1:php-pear-1.4.9-8.el5.noarch
3. Install php53-xml:
Jun 03 23:30:40 Installed: php53-xml-5.3.3-13.el5_8.x86_64
4. Install php54-xml and restart httpd to get the DOM extension for PHP
5. Install PHPUnit with PEAR:

pear install --alldeps phpunit/PHPUnit

6. Force PEAR to upgrade (PEAR can tell when a component is out of date, but it’s apparently too dumb to upgrade itself):

pear upgrade --force pear

7. Finally, install PHPUnit:

pear channel-discover
pear channel-discover
pear channel-discover
pear install --alldeps phpunit/PHPUnit

8. Finally, for profiling and code coverage, install xdebug:

pecl install xdebug

I haven’t applied my own procedure to a “fresh” RHEL/CentOS 5.9 system, so please let me know if you find any issues.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.