WHM / cPanel – Compile PHP 5.3 to work with PHP 5.2

This is one of major issue lot of web masters face now. As PHP 5.2 has reached end of life we are forced to seek options to migrate and test PHP applications in PHP 5.2 and 5.3. Raj COO from WebHostRepo.com has posted a nice blog post on how to achieve this.

Running PHP 5.3 along with PHP 5.2.x in cPanel servers.webhostrepo

I did all the steps as mentioned on the blog post except for one, I had a lengthier configure statement 😉

./configure --prefix=/usr/local/php53 --enable-cgi --disable-phar --enable-bcmath --enable-calendar --enable-exif --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo --enable-soap --enable-sockets --enable-wddx --enable-zip --with-curl=/opt/curlssl/ --with-freetype-dir=/usr --with-gd --with-gettext --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql --with-pdo-sqlite --with-pic --with-png-dir=/usr --with-sqlite=shared --with-tidy=/opt/tidy/ --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr

Install ZendGuardLoader

# cd
# wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
# tar xvzf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
# cd ZendGuardLoader-php-5.3-linux-glibc23-x86_64/
# mv php-5.3.x/ /usr/lib64

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

[Zend]
zend_extension="/usr/lib64/php-5.3.x/ZendGuardLoader.so"
zend_loader.enable=1

Happy migration 😉

Published
Categorized as Linux Tagged ,

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle