Most of the yum repos doesn’t include PHP5.6.X on current releases for the time being. So if you need PHP5.6.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 libtool-ltdl-devel libxml2-devel openssl-devel pcre-devel curl-devel gd-devel mysql-devel libxslt-devel

Download & install libmcrypt

wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
   10  tar zxvf libmcrypt-2.5.8.tar.gz 
   11  cd libmcrypt-2.5.8
   12  ./configure 
   13  make
   14  make install

Download FreeTDS source, don’t use yum to install freetds-devel!

wget ftp://ftp.freetds.org/pub/freetds/current/freetds-current.tar.gz
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.6.3 release:

wget http://php.net/get/php-5.6.3.tar.gz/from/this/mirror
mv mirror php-5.6.3.tar.gz
tar zxvf php-5.6.3.tar.gz
cd php-5.6.3
./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-mhash \
        --with-mcrypt \
        --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:

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:

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:

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

One Response to PHP5.6.3 on CentOS 6.6 with MSSQL Support
  1. […] PHP5.6.3 on CentOS 6.6 with MSSQL Support – … – Build and compile PHP 5.6 on CentOS 6.6 … Most of the yum repos doesn’t include PHP5.6.X on current releases for the time being. […]


[top]

Leave a Reply

Your email address will not be published. Required fields are marked *