centos5 cpu x86_64内核2.6.18 gcc 版本4.1.2 glibc 2.5 比较低旧的系统。yum 已经不支持,所有第三方库都要自己源码编译
libzip 用1.2.0版本,这个不用cmake,还可以./configure 配置Makefile
autoconf 用autoconf-2.68.tar.gz,也是要源码安装
编译脚本
Php_ver='php-7.3.25'
builddir='/root/bin'
tar -zxvf $Php_ver.tar.gz
cd $Php_ver
./buildconf --force
./configure --prefix=$builddir/php CC="gcc -std=gnu99" --with-config-file-path=$builddir/php/etc --with-config-file-scan-dir=$builddir/php/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=$builddir --with-freetype-dir=$builddir/freetype --with-jpeg-dir --with-png-dir --with-zlib=$builddir --with-libxml-dir=$builddir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache --enable-intl --with-xsl --includedir=$builddir/include --libdir=$builddir/lib --with-curl=$builddir --with-jpeg-dir=$builddir --with-png-dir=$builddir --with-freetype-dir=$builddir --with-mcrypt=$builddir --with-xsl=$builddir --with-openssl-dir=$builddir --with-libzip=$builddir
make ZEND_EXTRA_LIBS='-liconv'
make install
CC="gcc -std=gnu99" 这个是重要标志 否则会出现错误如下
ext/standard/.libs/var.o: In function `php_var_export_ex': /PHP/32/source/php7.1.4_zts/ext/standard/var.c:473: undefined reference to `isfinite' main/.libs/php_variables.o: In function `zend_dval_to_lval': /PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: undefined reference to `isfinite' Zend/.libs/zend_operators.o: In function `zendi_smart_strcmp': /PHP/32/source/php7.1.4_zts/Zend/zend_operators.c:2789: undefined reference to `isfinite' Zend/.libs/zend_operators.o: In function `zend_dval_to_lval': /PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: undefined reference to `isfinite' /PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: undefined reference to `isfinite' Zend/.libs/zend_operators.o:/PHP/32/source/php7.1.4_zts/Zend/zend_operators.h:117: more undefined references to `isfinite' follow collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1