Centos 6/7 安装 php7.3.x
CentOS6 不支持 php7.4版本的安装了(可能是我技术不行)
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
// 安装缺失库
yum -y install bzip2 bzip2-devel libxml2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel gmp-devel readline readline-devel libxslt openssl-devel 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
// 编译
./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 \
--enable-pcntl
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
如果configure的时候出现:configure: error: Cannot find OpenSSL's libraries
ln -s /usr/lib64/libssl.so /usr/lib/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术