Build PHP5.5 on CentOS 6.4 with MSSQL Support [cite]

Most of the yum repos doesn’t include PHP5.5.X on current releases for the time being. So if you need PHP5.5.X, you need to compile and build it for your self.

Advise: First of all, you should consider removing php packages from your server before compiling php, but beaware your codes will be visible till you install the compiled version to your server, consider shutting down your apache server for a while.
yum erase php*
Before downloading the code, install “Development Tools” by tiping:
yum groupinstall "Development Tools"
and install other related header files:
yum install httpd-devel libxml2-devel openssl-devel pcre-devel curl-devel gd-devel libmcrypt-devel mysql-devel libxslt-devel


Download FreeTDS source, don’t use yum to install freetds-devel!
wget ftp://ftp.astron.com/pub/freetds/stable/freetds-stable.tgz
tar zxvf freetds-stable.tgz
cd freetds-0.91/ #in my case
./configure --prefix=/usr/local/freetds --enable-msdblib
make
make install
cp include/tds.h /usr/local/freetds/include
cp src/tds/.libs/libtds.a /usr/local/freetds/lib
echo "/usr/local/freetds/lib" >> /etc/ld.so.conf
echo "export FREETDSCONF=/usr/local/freetds/etc/freetds.conf" >> /etc/profile
ln -s /usr/local/freetds/lib /usr/local/freetds/lib64
Download & extract php 5.5.5 release:

wget http://us2.php.net/get/php-5.5.5.tar.gz/from/this/mirror
tar zxvf php-5.5.5.tar.gz
cd php-5.5.5
./configure \
--with-apxs2 \
--with-curl=/usr/local/lib \
--with-gd \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
--with-freetype-dir=/usr/local/lib \
--with-kerberos \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-mysql=/usr \
--with-mysqli=/usr/bin/mysql_config \
--with-pdo-mysql=/usr \
--with-pcre-regex=/usr \
--with-pear \
--with-png-dir=/usr/local/lib \
--with-xsl \
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--with-iconv \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-soap \
--enable-sockets \
--enable-mbstring \
--enable-zip \
--enable-wddx \
--with-libdir=lib64 \
--with-mssql=/usr/local/freetds
Make & Install by typing:

<preclass="highlight">#make
#make install
#cp php.ini-production /etc/php.ini
#sed -i 's/;date.timezone =.*/  date.timezone \= "Europe\/Istanbul"/' /etc/php.ini
Don’t forget to add respective extension to httpd.conf:

<preclass="highlight">#echo "AddType application/x-httpd-php .php" >> /etc/httpd/conf.d/php.conf
#echo "AddType application/x-httpd-php-source .phps" >> /etc/httpd/conf.d/php.conf
and a final configuration:

<preclass="highlight">#"sed -i 's/DirectoryIndex index.html.*/  DirectoryIndex index.html index.html.var index.php/' /etc/httpd/conf/httpd.conf
please let us know if you find any mistake
  • 110 Users Found This Useful
Was this answer helpful?

Related Articles

Setting time with NTP in LINUX

NTP (Network Time Protocol) could be used to set time synced with ntp clocks, to do this use the...

Linux version & Operating System info

LINUX Version Info To learn the architecture and kernel version info use the shell command...

Change Outgoing IP of Postfix Mail Server

This can get quite important when your mail server is blacklisted, or if you somehow want to...

Add New Hosting to a System Installed With Plugged.sh

If you use our LAMP installer script and want to add a new domain afterwards, we’ve created...

Getting Network Information in Bash Scripts

Sometimes when writing your bash scripts, you may need some information about the network, such...