下载PHP文件
curl -o php-7.1.8.tar.gz https://www.php.net/distributions/php-7.1.8.tar.gz
解压
tar -zxvf php-7.1.8.tar.gz
进行 ./configure 之前,对php常用的依赖进行安装
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libxslt-devel
yum install openssh-server vim net-tools iproute htop lsof iostat tcpdump git atop wget supervisor dstat unzip mysql redis memcached telnet nc -y && yum clean all
执行下面的参数
./configure --prefix=/usr/local/services/7.1.8 \
--with-config-file-path=/usr/local/etc/php/7.1.8 \
--with-config-file-scan-dir=/usr/local/etc/php/7.1.8/conf.d \
--with-openssl=/usr/local/opt/openssl \
--with-mysqli \
--with-pdo-mysql \
--with-iconv-dir \
--with-freetype-dir=/usr/local/freetype \
--with-zlib \
--with-jpeg-dir \
--with-png-dir \
--with-libxml-dir=/usr/bin/xml2-config \
--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-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-maintainer-zts \
--enable-mysqlnd
1 : openssl 1.0.1 version问题
无论是升级 openssl 还是加装 pkg-config 都无法解决
最终的解决方式
升级 openssl 后
ln -s /usr/local/services/openssl/1.0.2r/include/openssl /usr/local/include/openssl
安装
make -j 4 && make install
配置PHP到环境变量中
ln -s /usr/local/services/7.1.8/sbin/php-fpm /usr/local/sbin/php-fpm
ln -s /usr/local/services/7.1.8/bin/php /usr/local/bin/php