一、下载
网址:http://cn2.php.net/get/php-7.1.6.tar.gz/from/a/mirror
我选择了一个香港近一点的服务器下载
下载之后是一个tar.gz文件,ftp上传到你的linux服务器。
二、解压
tar -xvf php-7.1.6.tar.gz
cd php-7.1.6
执行编译的时候报了如下错误:
[root@localhost php-7.1.6]# ./configure
Configuring extensions
checking size of long... (cached) 8
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking for gettimeofday... (cached) yes
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
执行如下命令
yum install libxml2
yum install libxml2-devel -y
再次执行./configure
成功生成makefile
然后执行:
[root@localhost php-7.1.6]# make & make install
在make的时候遇到了如下错误:
libtool: link: `ext/opcache/ZendAccelerator.lo' is not a valid libtool object
执行如下:
make distclean
重新生成makefile,再执行make命令,发现编译成功了,执行make install
完成php的安装。
[root@localhost php-7.1.6]# php -v
PHP 7.1.6 (cli) (built: Sep 4 2018 11:31:08) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies