Friday, June 6, 2008

Install PHPUnderControl on CentOS 5.1

This is a quick write-up on how to install PHPUnderControl on CentOS 5.1. I mainly write this for my own reference, but will go in more details in (near) future.

CentOS 5.1 has problems with PHP up-to-date version, so while trying to install PHPUnderControl I hit the following problem:

phpUnderControl requires PHP (version >= 5.2.0), installed version is 5.1.6
phpUnderControl requires PEAR Installer (version >= 1.6.0), installed version is 1.4.9

Here how to update PHP to 5.2.6 and PEAR to 1.7.1 (ON 07 JUNE 2008). There is no officially supported packages but remi provided good RPMs for this on his repo:

$ wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm
$ wget http://rpms.famillecollet.com/el5.i386/remi-release-5-4.el5.remi.noarch.rpm
# rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
# yum --enablerepo=remi update php
# yum --enablerepo=remi update php-pear

(NOTE: Some things you have to do as root.)

Just in case something messes up, here how to reverse this process and get back original packages. Of course, then there is no point in trying to install PHPUnderControl, but will get your PHP environment in working state.

# yum --disablerepo=remi remove php php-cli php-common
# yum install php

After solving PHP version issue, the installation of PHPUC is more-less smooth when you know what You need ;) And it goes like this:

Download and place in /opt/cruisecontrol. I have put it in /opt/cruisecontrol-2.7.2 and made a symbolic link to /opt/cruisecontrol so it's easier to transit between versions in future.

# ln -s /opt/cruisecontrol-bin-2.7.2/ /opt/cruisecontrol
  • Install PHPunderControl and all dependencies
Use PEAR. By using --alldeps, it will also install all necessary support add-ons (PHPDocumentor-1.4.2, PHPUnit-3.2.20, PHP_CodeSniffer 1.1.0RC1

# pear config-set preferred_state beta
# pear channel-discover components.ez.no
# pear channel-discover pear.phpunit.de
# pear install --alldeps phpunit/phpUnderControl

At the end you should see something like this:
...
install ok: channel://pear.php.net/DB-1.7.14RC1 install ok: channel://pear.php.net/PhpDocumentor-1.4.2 install ok: channel://pear.php.net/PHP_CodeSniffer-1.1.0RC1 install ok: channel://pear.php.net/Image_GraphViz-1.3.0RC3 install ok: channel://pear.php.net/Log-1.10.1 install ok: channel://pear.php.net/XML_Beautifier-1.1 install ok: channel://pear.phpunit.de/PHPUnit-3.2.20 ...

Now, you should read PHPUnderControl documentation on how to setup example project. The easiest way is to use command line tools and generate all necessary files to get the smell of PHPUC. Later, You might want to customize your project settings to customize build process.

At the end I would like to thank to the people that wrote all this great opensource software, and to others that provided tutorial I have (ob)used to create this small tip. In case You find something wrong or missunderstanting, don't hesitate to comment.

Reference:
  1. http://bluhaloit.wordpress.com/2008/03/13/installing-php-52x-on-redhat-es5-centos-5-etc/
  2. http://www.phpundercontrol.org/download.html
  3. http://nohn.net/blog/view/id/cruisecontrol_ant_and_phpunit

2 comments:

Daniel Skinner said...

Thanks for the helping hand, I've been trying to get this working all day!

mike said...

thanks for sharing! keep up the good work

history today

There was an error in this gadget