Bluhalo IT


Compiling PHP with Oracle support on CentOS 5.2

Posted in Apache, linux by Simon Green on April 30, 2009

Getting PHP and oracle to play nice is a massive pain, so this post is more a log for myself next time I have to do it more than anything else!

The procedure requires you to compile PHP from source, so if thats not your thing or your easily scared don’t bother continuing!

Firstly an enormous yum install command to get everything we need in one go:

# yum install openssh-server httpd httpd-devel apxs libx openssl-devel curl-devel libpng-devel\
 oci8-devel libxml libxml2 libxml2-devel libjpeg libXpm libXpm-devel libpng libxslt libxslt-devel\
 freetype freetype-devel

Go and grab the instant client from the oracle website and install it with RPM:

# rpm -i oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm
# rpm -i oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm

And then get the PHP source (substitute for whatever the latest version is at your compile time obviously):

# wget http://uk.php.net/get/php-5.2.8.tar.gz/from/this/mirror
# tar -xzf php-5.2.8.tar.gz
# cd php-5.2.8

And finally configure it all together:

# ./configure  --with-apxs2=/usr/sbin/apxs --with-zlib --without-gdbm --enable-force-cgi-redirect\
 --enable-ftp --enable-xml --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin\
 --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib\
 --libexecdir=/usr/libexec --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info\
 --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-pear --enable-pdo\
 --with-oci8=instantclient,/usr/lib/oracle/11.1/client/lib --with-pdo-oci=instantclient,/usr,11.1\
 --with-xsl --with-curl --with-openssl --enable-soap --enable-sockets --enable-sigchild --enable-xdebug\
 --with-jpeg-dir --with-xpm-dir --with-png-dir --with-freetype-dir --with-ttf --enable-gd-native-ttf --with-gd

And with a bit of luck you should be up and running. Obviously now you have to do battle with Oracle itself which is a minefield of confusion!

How to quickly setup a load balanced, high availability, Apache cluster

Posted in Apache, linux by Simon Green on April 29, 2009

I wanted to find a simple to maintain and expand soultion for load balancing a web cluster with high availability. I have found my solution in HAProxy.

Scenario

Bluhalo Labs HAProxy Test Rig

Bluhalo Labs HAProxy Test Rig

This demo scenario is in the following enviroment:

  • Network Configuration
    • Network: 192.168.11.0
    • Subnet Mask: 255.255.255.0
    • Gateway: 192.168.11.254 (Although this is irrelavant)
  • 1 x Shared IP for the Load Balancers
    • 192.168.11.40
  • 2 x Load Balancers
    • BHLabs1 – 192.168.11.30
    • BHLabs6 – 192.168.11.39
  • 4 x Web Servers
    • BHLabs2 – 192.168.11.35
    • BHLabs3 – 192.168.11.36
    • BHLabs4 – 192.168.11.37
    • BHLabs5 – 192.168.11.38

At the start of this setup all machines are running Ubuntu 8.04 Server from a standard install with openssh-server installed and the root password set. All setup commands are run as root or with sudo. (more…)