Monday, August 24, 2009

Install PHP 5.3 on CentOS

A couple days ago I compiled and installed PHP 5.3 with MySQL and SOAP support on a CentOS box since its not available in Yum repo. Here is some notes and problem I encountered. My configuration:

./configure --with-mysql=shared --enable-pdo --with-pdo-mysql=shared --with-mcrypt=shared --with-mhash=shared --with-gd=shared --enable-soap=shared --with-config-file-path=/etc/ --with-jpeg-dir=/usr/lib/ --with-apxs2 -–with-mysqli --enable-zip -–enable-shared


The only problem I ran into other than installing all the dependencies is libxml2 library that PHP depends on is currently not available in Yum repo you will have to download it and install manually.

wget ftp://xmlsoft.org/libxml2/LATEST_LIBXML2
tar -xf LATEST_LIBXML2
cd libxml2-x.x.x
./configure
make
sudo make install

Wednesday, August 19, 2009

Redirect AntBuilder output in Groovy

In Groovy you can use the following code to redirect default AntBuilder output to a log file:


def ant = new AntBuilder()
def logOutput = new PrintStream(logFile)

// redirect std out and error output
System.out = logOutput
System.err = logOutput

// redirect ant output
ant.project.getBuildListeners().each{
it.setOutputPrintStream(logOutput)
}