How to install GEOS on CentOS and directadmin

cd /usr/local/src
wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2  # go here to find the latest version: http://download.osgeo.org/geos/
tar -xvjf geos-3.4.2.tar.bz2
cd geos-3.4.2
./configure --enable-php; make clean ; make
make install
ldconfig
vi /etc/ld.so.conf

Add the following line if it doesn't already exist

/usr/local/lib

Find the location of the newly installed geos.so

updatedb
locate geos.so

You'll get something like this:

/usr/local/lib/php/extensions/no-debug-non-zts-20090626/geos.so

Add the extension info to your php.ini

vi /usr/local/lib/php.ini

Add the following (somewhere around the rest of your extension, e.g. APC):

For PHP 5.3:

; GEOS extension
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626/"  
extension=geos.so

For PHP 5.4:

; GEOS extension
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20100525/"  
extension=geos.so

For PHP 5.5:

; GEOS extension
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212/"
extension=geos.so