1、先安装好php7.2,因需要再安装一个php5.2版本
2、下载源码 http://museum.php.net/php5/php-5.2.17.tar.gz
解压之后,放在/usr/local/php52目录,再进行编译安装
./configure --with-mysql=/usr/local/mysql --prefix=/usr/local/php52 --enable-fastcgi --enable-zip --enable-fpm --enable-gd-native-ttf --with-config-file-path=/usr/local/php52/etc --with-config-file-scan-dir=/usr/local/php52/etc/php.d --with-curl --with-libxml-dir=/usr/lib64 --with-gd --with-jpeg-dir --with-freetype-dir=/usr/lib64 --with-png-dir --with-mcrypt --with-mhash --enable-mbstring --with-kerberos --with-gettext --enable-bcmath –with-iconv=/usr/local/
此时会报错 undefined reference to `libiconv' ,此时修改 vim 当前目录的 Makefile文件,查找-lcrypt,在后面添加 -liconv ,之后再执行make && make install操作即可。