我是用的环境是虚拟机,centos7 ,cmake3.17.3
1.卸载旧版libzip:
yum -y remove libzip
2.安装新版libzip:
cd /usr/local/src #1.切换到压缩包下载目录
wget https://libzip.org/download/libzip-1.5.2.tar.gz #2.下载压缩包
tar -zxvf libzip-1.5.2.tar.gz #3.解压压缩包
cd libzip-1.5.2 #4.切换到解压目录
mkdir build #5.创建build文件夹
cd build #6.切换到build文件夹
cmake .. #7.cmake编译,注意存在两个.
make #8.编译
make install #9.安装
3.配置新版 lib:
vi /etc/ld.so.conf
#添加如下配置:
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#更新配置:
ldconfig -v
4.下载PHP压缩包:
https://www.php.net/downloads.php
下载地址截图
5.使用ftp远程工具上传到/usr/local/src目录下
6.解压:
tar -zxvf php-7.3.19.tar.gz
7.切换到解压目录:
cd php-7.3.19
7.编译:
./configure \
--prefix=/usr/local/php\
--enable-fpm\
--with-fpm-user=www\
--with-fpm-group=www\
--with-config-file-path=/usr/local/php/conf\
--disable-rpath\
--enable-soap\
--with-libxml-dir\
--with-xmlrpc\
--with-openssl\
--with-mhash\
--with-pcre-regex\
--with-zlib\
--enable-bcmath\
--with-bz2\
--enable-calendar\
--with-curl\
--enable-exif\
--with-pcre-dir\
--enable-ftp\
--with-gd\
--with-openssl-dir\
--with-jpeg-dir\
--with-png-dir\
--with-zlib-dir\
--with-freetype-dir\
--enable-gd-jis-conv\
--with-gettext\
--with-gmp\
--with-mhash\
--enable-mbstring\
--with-onig\
--with-mysqli=mysqlnd\
--with-pdo-mysql=mysqlnd\
--with-zlib-dir\
--with-readline\
--enable-shmop\
--enable-sockets\
--enable-sysvmsg\
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx\
--with-libxml-dir\
--with-xsl\
--enable-zip\
--with-pear
8.安装:
make
make install
9.复制配置文件:
cd /usr/local/php
mkdir conf
cp /usr/local/src/php-7.3.19/php.ini-production /usr/local/php/conf/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
10.配置环境变量:
vi /etc/profile
下面添加:
php=/usr/local/php/bin
PATH=$PATH:$php
export PATH
11.刷新:
source /etc/profile
12.执行phpinfo():
<?php
phpinfo();
?>
phpinfo截图
网友评论