skip to Main Content
+971 55 881 1725 hmimthiaz @

Compile PHP 5.3.19 on CentOS 6.3 with Curl 7.28


For this installation I choose CentOS 6.3 minimal version. You can download the ISO from the mirrors or direct download it from SYNc yourself. Once the CentOS installation is completed make sure you are connected to Internet to update the latest libraries.


Note: These steps are done assuming you are logged in as root user

1. Please update the available updates for the OS and restart

2. Install EPEL (Extra Packages for Enterprise Linux) so that you can get all the needed libraries for compiling PHP

3. Install Development Tools – Detailed User Guide

4. Install MySQL Database client

5. Install the following libraries which are required for different modules in PHP. Please make sure all the dependencies are met before installation

6. For this installation I planned to use the latest version of curl so I had to my custom curl compilation

7. Download and compile PHP 5.3.19

8. Copy php.ini

9. Edit Apache conf check if “LoadModule” is present else add it.

LoadModule php5_module /usr/lib64/httpd/modules/

10. Set handler for Apache to handle PHP files

11. If you are not planning to install ZendGuardLoader skip to step 13 else make sure you have disabled SElinux. Detailed instructions

12. Install ZendGuardLoader

Edit /usr/local/php-5.3.19/lib/php.ini and add these lines to end

13. Restart you apache and you are set

It took a great deal of time to make this work and with lot of trial and errors. If anyone finds a better way to compile please do share it with me. All the best 😉

VirtualBox web interface with phpVirtualBox

This weekend I had some time to spend with VirtualBox. VirtualBox is a cross-platform virtualization application. This helps you to run various operating system as virtual machine. This is the concept that is adapted by most of the companies which offer us cloud computing. Recently I came to know that VirtualBox has built in Web service with which we can control the virtual instances remotely. My immediate reaction was to search for some open source solution which uses web service of VirtualBox. phpVirtualBox came to rescue. It has full fledged features which can be use used to control VirtualBox installed in a server.

phpVirtualBox – An open source, AJAX implementation of the VirtualBox user interface written in PHP. As a modern web interface, it allows you to access and control remote VirtualBox instances. Much of its verbage and some of its code is based on the (inactive) vboxweb project. phpVirtualBox was created for people (like me) who prefer not to have to log in to their headless VirtualBox host to administer their virtual machines.

To make it work in Mac I had to install the latest beta version of phpVirtualBox (4.1-1b) for VirtualBox (4.1.2). The current stable version had some issues with authentication. However, phpVirtualBox has wiki which helps to install and configure the web application. If you encounter any issues please refer to common errors in phpVirtualBox wiki.

Happy journey with virtualization 🙂

Facebook Open Graph Meta WordPress Plugin

Today I wanted put Facebook Open Graph Protocol meta tags on my blog. I searched for a long time and I was not able to get a simple and working plugin for WordPress. So I decided to write my own. If you want use this plugin please make sure you replace the tag [REPLACE] with appropriate values.

This plugin is already activate on my blog. If anyone shares or likes a link from my blog it will have all full details on facebook 😉

Download Facebook Open Graph Meta WordPress Plugin

Leopard + Apache 2 + NTLM + PHP + Integrated Windows Authentication

Everyday we face lot of challenges and today it was to make our CMS work with NTLM(NT LAN Manager Windows authentication protocol) Single Sign-On. I hope you didn’t get any shit what I meant above and so was I when I got the requirement.

In windows network we can connect all computers to a domain and it will have a domain controller. Once your computer is connected to the domain you will be asked enter your domain user name and password when ever you log on to system. After you log in it will use the same credentials to authenticated all the domain related objects like network, files, exchange and so on. In most of the corporations this how they manage the systems with group policies applied to each users.

In Internet explorer there is a feature to use the same credentials to authenticate intranet websites. This is Single Sign-ON. There is very nice article which can help you if you want to set it up.

So my application should be able to detect whether the browser is authenticated already or raise if needed and it will validate the credential with domain controller. There is no direct methods available in PHP to achieve this. So to achieve this I had to rely on NTLM auth module for Apache. It was pretty outdated and Raimonds Simanovskis has updated the source tree and had released a patched version here. I was able to compile it without any issues. Download and extract the files and run this.

#sudo /usr/sbin/apxs -i -a -c mod_ntlm.c
Libraries have been installed in:
chmod 755 /usr/libexec/apache2/
[activating module `ntlm' in /etc/apache2/httpd.conf]

Most important part adding ntlm module to Apache is done. The next step in make some some modification in htaccess file. Configuration setting can be read in detail from here.

AuthName NTAuth
AuthType NTLM
NTLMAuth on
NTLMAuthoritative on
NTLMLockfile /tmp/_my.lck
require valid-user

Make sure that the computer where you have installed apache should be able to connect to domain controller. Always use full domain names and not IP as it will give errors while connecting [reference] . You are fully set now and if everything is correct you will get these variables in PHP with current logged in details.

$_SERVER['REMOTE_USER'] => xxxxx

I have tested this with Internet explorer and it will work without asking password. For other browsers like Firefox, Chrome, Safari it will prompt for authentication. Thats all folks 😉

Compile and install PHP 5.2.8 on Mac OS X 10.5.6 (Leopard)

Due to some limitation I faced with Xampp I finally decided to compile PHP5 native on my mac. Entropy was a best option for mac till Leopard was released. Since Leopard came with php built in entropy was no more available. After Googling for a long time and breaking my head with errors for 7 long hours I finally got it working perfectly like how I wanted it. These are some of the steps I followed to compile the same. I tested the same steps in 2 macs and it was working fine. I cannot guarantee that these steps would work for everyone.

Step 1

You need to have Xcode installed on your mac. In my case I had Xcode 3.1.2 installed. You can install from your Leopard DVD or you can install iPhone SDK.

Step 2

Download and install the latest Mysql database server.

Step 3

Install Fink. You can download the version 0.9.0 which I used for compiling from here. Once you have installed open terminal and issue the following commands.

# sudo fink selfupdate
# sudo fink update-all

The above two commands will update the needed files for fink library to work properly. Once this is done you can install needed libraries for php by issuing the following command

# sudo fink install libjpeg libtiff libpng3 libxml t1lib5 libmcrypt libmhash mysql15-dev curl wget

Step 4

Install FrontBase if it is needed for you. It is installer file you can download it from here. If you don’t want to use this database system you can remove the option ‘–with-fbsql’ from the php configure command.

Step 5

Install Freetds if you want use MS-SQL in PHP5.

# sudo su
# curl -O
# tar xvzf freetds-stable.tgz
# cd freetds-0.82/
# ./configure && make && sudo make install

Incase if you feel this is not needed for your installation you can remove the option ‘–with-mssql’ and ‘–enable-dbase’ from the php configure command.

Step 6

Install Imap Client libraries files. You need this lib to be installed if you wish to compile imap. If you don’t want you can remove the option ‘–with-imap’ and ‘–with-imap-ssl’. Further reading on this topic visit here.

# sudo su
# curl -O
# tar xvzf c-client.tar.Z
# cd imap-2007e/
# make oxp
# cd c-client/
# cp *.h /usr/local/include
# cp *.c /usr/local/lib
# cp c-client.a /usr/local/lib/libc-client.a

Step 7

Install gettext. This is a must for lot of open source projects and for localization.

# sudo su
# curl -O
# tar xvzf gettext-0.17.tar.gz
# cd gettext-0.17
# cd gettext-tools/
# ./configure
# make
# make install

Step 8

Install freetype. You need if you wish to load free type fonts in GD.

#sudo su
# wget
# tar xvzf freetype-2.3.8.tar.gz
# cd freetype-2.3.8
# ./configure
# make
# make install

Step 9

I think we are pretty there and now it is time to compile the big boss the PHP itself.

# sudo su
# wget
# tar xvzf php-5.2.8.tar.gz
# cd php-5.2.8
# ./configure --prefix=/usr/local/php5.2.8 --with-apxs2 --with-config-file-scan-dir=/usr/local/php5.2.8/php.d --with-openssl=/usr --with-zlib=/usr --with-gd --enable-gd-native-ttf --with-jpeg-dir=/sw --with-jpeg-dir=/sw --with-png-dir=/sw --with-zlib-dir=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-soap --enable-ftp --enable-sockets --enable-mbstring --enable-calendar --enable-bcmath --with-bz2=/usr --with-curl --with-kerberos=/usr --with-libxml-dir=/sw --with-xsl --with-t1lib=/sw --with-mcrypt=/sw --with-mhash=/sw --with-mysql=/sw --with-mysqli --with-pdo-mysql=/sw --enable-zip --with-imap --with-imap-ssl --with-gettext --with-curl=/sw --with-pear --with-regex --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv=shared,/opt/local --enable-dbase --enable-sqlite-utf8 --with-fbsql
# make
# make install

If you have completed till the above step without any error means that you have successfully installed PHP5. If you restart your apache server from system settings the server might not work for you. Since it might conflict a bit due to various architecture problems in apache and php build. To over come this issue you need to re-compile apache. You can do it by issuing the following commands. Further reading on this issue.

Step 10

Recompile Apache 2.

# sudo su
# wget
# tar xvzf httpd-2.2.11.tar.gz
# cd httpd-2.2.11/
# ./configure --enable-layout=Darwin --enable-mods-shared=all
# make
# make install


Once everything is done you should be able to run PHP. Have fun compiling your own native PHP on your mac 😉 .!!!

Back To Top