Install php from source – custom path

Hey guys,

Recently I wanted to give php 5.4 a go but without interferring with my current setup, so I choosed to run it as fcgi.
In order to do that I wanted to compile php from source, enabling the modules I needed (gd with jpg support), bmath, pdo, pdo_mysql (for magento) and so on

here we go:
1. go to php site and download your version
2. upload to your server and unarchive it somewhere 🙂
3. go using putty or something similar to where are the files extracted, enter the source directory
4. I used this command, change it per your needs:

./configure -enable-bcmath -enable-calendar -enable-fastcgi -enable-ftp -enable-gd-native-ttf -enable-libxml -enable-mbstring -enable-soap -enable-sockets -prefix=/usr/local/php-5.4.9-fcgi --with-curl=/opt/curlssl/ --with-jpeg-dir=/usr/lib --with-jpeg --with-png-dir=/usr/lib --with-gd --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-zlib --with-zlib-dir=/usr -enable-pdo --with-pdo-mysql=/usr -enable-zend-multibyte --with-freetype-dir=/usr --with-gettext --with-ttf -enable-force-cgi-redirect -enable-sysvsem -enable-sysvshm --with-imap --with-kerberos=/usr --with-imap-ssl --with-xsl -enable-zip

I included imap support, so prior to configure:

yum install libc-client-devel.i386
yum install libxlst
yum install libxlst-devel

then:

make
make install

make sure you rename and copy the development php.ini to the lib/php.ini