安装依赖包
yum install epel-release -y
yum -y install wget vim pcre pcre-devel openssl openssl-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel curl curl-devel openldap openldap-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel libzip libzip-devel
下载并编译安装PHP7.2
cd /opt
wget -c http://cn2.php.net/distributions/php-7.3.16.tar.gz
tar zxvf php-7.3.16.tar.gz
cd php-7.3.16
./configure --prefix=/usr/local/php-7.3.16 --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --enable-fileinfo
......
......
......
make
make install
编辑错误:
checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11
#先删除旧版本
yum remove -y libzip
#下载编译安装
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install
error: off_t undefined; check your library configuration
vim /etc/ld.so.conf
#添加如下几行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#保存退出
ldconfig -v # 使之生效
/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or dire
#解决方法:手动复制过去
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
配置PHP
复制配置文件到安装目录中
cp php.ini-production /usr/local/php-7.3.16/lib/php.ini
cp /usr/local/php-7.3.16/etc/php-fpm.conf.default /usr/local/php-7.3.16/etc/php-fpm.conf
cp /usr/local/php-7.3.16/etc/php-fpm.d/www.conf.default /usr/local/php-7.3.16/etc/php-fpm.d/www.conf
添加组及用户
groupadd www
useradd www -g www -s /sbin/nologin
启动php-fpm
ln -s /usr/local/php-7.3.16/sbin/php-fpm /usr/sbin/
ln -s /usr/local/php-7.3.16/bin/php /usr/bin/
php-fpm






网友评论