php5.2是centos5时期流行的版本。但是由于centos5已经淘汰,php5.2也已经推出舞台。
但是某些2003-2010年的php程序,还是基于php4或php5.2之前的版本开发的,于是,不是很兼容php5.3,php5.6,php6 php7 等版本,我们希望在保留最新的php版本基础上,也安装一个php5.2版本,给某些特别的程序使用。比如需要 Zend Optimizer 支持的程序
这里www.ctohome.com提供的方法是基于centos6.x 64bit测试有效,请参考:
yum -y install gcc make gcc-c++ cpp libxml2-devel openssl-devel bzip2-devel libjpeg-devel libpng-devel freetype-devel openldap-devel postgresql-devel aspell-devel net-snmp-devel libxslt-devel libc-client-devel libicu-devel gmp-devel curl-devel libmcrypt-devel unixODBC-devel pcre-devel sqlite-devel db4-devel enchant-devel libXpm-devel mysql-devel readline-devel libedit-devel recode-devel libtidy-devel mhash libmhash libmhash-devel expat expat-devel libvarnishapi-dev
cd /backup/www.ctohome.com
wget http://museum.php.net/php5/php-5.2.17.tar.gz
tar -zxvf php-5.2.17.tar.gz
cd php-5.2.17
./configure --prefix=/usr/local/php52 --disable-posix --enable-bcmath --enable-calendar --enable-exif --enable-cgi --enable-fastcgi --enable-force-cgi-redirect --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo --enable-soap --enable-sockets --enable-zip --with-bz2 --with-curl --with-curlwrappers --with-freetype-dir --with-gd --with-gettext --with-imap --with-imap-ssl --with-jpeg-dir --with-kerberos --with-libxml-dir --with-libxml-dir --with-mcrypt --with-mhash --with-mime-magic --with-mysql --with-mysqli --with-openssl --with-openssl-dir --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pic --with-png-dir --with-pspell --with-sqlite --with-ttf --with-xmlrpc --with-xpm-dir --with-xsl --with-zlib --with-zlib-dir --enable-wddx --with-libexpat-dir --with-libdir=lib64
make
make install
mkdir -p /opt/rh/php52/root/usr
ln -s /usr/local/php52/bin /opt/rh/php52/root/usr/bin
接下来安装zend:
接下来安装php缓存加速:
最后结果:
[[email protected]]# /opt/rh/php52/root/usr/bin/php-cgi -v
PHP 5.2.17 (cgi-fcgi) (built: Oct 31 2017 15:23:42)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with eAccelerator v1.0-dev, Copyright (c) 2004-2012 eAccelerator, by eAccelerator
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies