首先是安装需要的扩展文件
yum -y install freetype-devel yum -y install libpng-devel yum -y install libjpeg-devel yum -y install libcurl-devel yum -y install libxml2-devel yum -y install libXpm-devel yum -y install openssl openssl-devel yum -y install postgresql-devel
PHP当前最新版本是PHP7.3,今天在尝试安装的过程中报如下错误: system libzip must be upgraded to version >= 0.11, 根据提示我们可以清楚的知道是因为系统自带的libzip版本低了,这里我们需要安装最新的libzip
首先,卸载系统自带的libzip
yum -y remove libzip-devel
然后从官网下载并编译安装
wget https://libzip.org/download/libzip-1.3.2.tar.gz tar xvf libzip-1.3.2.tar.gz cd libzip-1.3.2 ./configure make && make install
如果是下载1.5.*以上版本,则需要采用如下安装方式 提示需要cmake 3.1 以及以后版本
yum -y install cmake wget https://libzip.org/download/libzip-1.5.1.tar.gz tar -zxvf libzip-1.5.1.tar.gz cd libzip-1.5.1 mkdir build cd build cmake .. make && make install
下面是配置编译文件,可以根据需要添加减少扩展。
./configure --prefix=/application/php-7.3.8 --with-pgsql=shared --with-pdo-pgsql=shared --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-zlib-dir=/usr/local/zlib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl --enable-ctype
或者写成多行的:
./configure --prefix=/application/php-7.3.8
--with-pgsql=shared --with-pdo-pgsql=shared
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
--with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg
--with-freetype-dir=/usr/local/freetype
--with-xpm-dir=/usr/
--with-zlib-dir=/usr/local/zlib
--with-iconv
--enable-libxml
--enable-xml
--enable-bcmath
--enable-shmop
--enable-sysvsem
--enable-inline-optimization
--enable-opcache
--enable-mbregex
--enable-fpm
--enable-mbstring
--enable-ftp
--with-openssl
--enable-pcntl
--enable-sockets
--with-xmlrpc
--enable-zip
--enable-soap
--without-pear
--with-gettext
--enable-session
--with-curl
--enable-ctype
最后就是安装了 make 的时间稍微有点长。
make make install