php7.3.x编译安装。
// 后面会提示 system libzip must be upgraded to version >= 0.11 所以提前卸载,自己编译。
yum -y remove libzip-devel libzip
// 就下载这个版本,别下载太高的,centos6上编译不过
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 -j make install
---- 好像只有centos6需要以下操作------
yum -y install bzip2 bzip2-devel libxml2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel gmp-devel readline readline-devel libxslt libxslt-devel
vim /etc/ld.so.conf
#添加如下几行 /usr/local/lib64 /usr/local/lib /usr/lib /usr/lib64
#保存退出
ldconfig -v
#使之生效
重要:
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
// 下载PHP
wget https://www.php.net/distributions/php-7.3.24.tar.gz tar -zxvf php-7.3.24.tar.gz cd php-7.3.24.tar.gz
// 配置
./configure \ --prefix=/usr/local/php73 \ --with-config-file-path=/usr/local/php73/etc \ --enable-fpm \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-inline-optimization \ --disable-debug \ --disable-rpath \ --enable-shared \ --enable-soap \ --with-libxml-dir \ --with-xmlrpc \ --with-openssl \ --with-mhash \ --with-pcre-regex \ --with-sqlite3 \ --with-zlib \ --enable-bcmath \ --with-iconv \ --with-bz2 \ --enable-calendar \ --with-curl \ --with-cdb \ --enable-dom \ --enable-exif \ --enable-fileinfo \ --enable-filter \ --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-json \ --enable-mbstring \ --enable-mbregex \ --enable-mbregex-backtrack \ --with-onig \ --enable-pdo \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-zlib-dir \ --with-pdo-sqlite \ --with-readline \ --enable-session \ --enable-shmop \ --enable-simplexml \ --enable-sockets \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-wddx \ --with-libxml-dir \ --with-xsl \ --enable-zip \ --enable-mysqlnd-compression-support \ --with-pear \ --enable-opcache
//编译安装
make -j && make install
// 配置文件修改:
cp php.ini-production /usr/local/php73/etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/init.d/php73-fpm cp /usr/local/php73/etc/php-fpm.conf.default /usr/local/php73/etc/php-fpm.conf cp /usr/local/php73/etc/php-fpm.d/www.conf.default /usr/local/php73/etc/php-fpm.d/www.conf
#php-fpm 端口可在 www.conf 里修改
chmod +x /etc/init.d/php73-fpm /etc/init.d/php73-fpm start
#php73加入环境变量
ln -s /usr/local/php73/bin/php /usr/local/bin/php73
#开机自启动
vim /etc/rc.local /etc/init.d/php73-fpm start
#修改不显示X-Power-By
vim /usr/local/php73/etc/php.ini
找到 expose_php
把 on 改为 off
/etc/init.d/php73-fpm restart