一个伪linux粉丝的blog

  1. 首页
  2. network
  3. 正文

A Failed PHP Upgrade

14 10 月, 2025 9点热度 0人点赞 0条评论

背景

最近偶尔更新博客时,后台会提示

"您的站点正在运行过时版本的 PHP (8.0.8),其无法接收安全更新,且应当被升级。"

国庆假期有空,准备升个级,访问 https://www.php.net/releases/  发现最新的是今年8月发布的 8.3.25 ,没想到一路踩坑,

后果是导致网站停止访问1天:(  Web server is down Error code 521,记录一下这次失败的经历。

步骤

 节点是 21年部署的lnmp1.8 ,4年多了,抱着简单粗暴的心理,直接执行了 ./upgrade.sh php 命令,返回
Current PHP Version:8.0.8  输入最新版的版本号 8.3.25,开始升级。

过程中的坑点

提示libzip 问题

于是下载编译 libzip,wget -c https://libzip.org/download/libzip-1.11.4.tar.gz 报错

OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
换curl下载 curl -k https://libzip.org/download/libzip-1.11.4.tar.gz -LO
报错 curl: (35) Cannot communicate securely with peer: no common encryption algorithm(s).
原因是节点openssl 太老了 openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017
发现最低也要 OpenSSL 1.1.1n 15 Mar 2022
先绕行,其它节点下载了拷贝过来

接着编译 libzip  ,过程又提示 cmake 没有,要先安装。

yum groupinstall -y "Development Tools"  zlib-devel
  • 编译cmake
1
2
3
4
5
6
7
8
curl -O https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz
tar -zxvf cmake-3.10.0-Linux-x86_64.tar.gz
sudo mv cmake-3.10.0-Linux-x86_64 /usr/local/cmake
# 将CMake添加到环境变量
echo 'export PATH=/usr/local/cmake/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# 验证版本
cmake --version

  • 继续编译 libzip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
wget -c https://libzip.org/download/libzip-1.11.4.tar.gz
tar -zxvf libzip-1.11.4.tar.gz
cd libzip-1.11.4
mkdir build && cd build
cmake ..
make
sudo make install
 
# 将库路径添加到系统配置
echo '/usr/local/lib64' | sudo tee /etc/ld.so.conf.d/local.conf
echo '/usr/local/lib' | sudo tee -a /etc/ld.so.conf.d/local.conf
# 更新库缓存
sudo ldconfig
 
# 设置 pkg-config 路径
 
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH
 
# 验证 pkg-config 是否能找到 libzip
pkg-config --libs --cflags libzip

编译 libiconv

接着编译php,发现 提示缺 libiconv,解决下

1
2
3
4
5
6
cd /root/lnmp1.8-full/src
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz
tar -zxvf libiconv-1.17.tar.gz
cd libiconv-1.17
./configure --prefix=/usr/local/libiconv
make && make install

正式编译 php

1
2
3
4
5
cd /root/lnmp1.8-full/src
tar -jxvf php-8.3.25.tar.bz2
cd php-8.3.25
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www  --with-mysqli --with-pdo-mysql --with-iconv=/usr/local/libiconv --with-zip=/usr/local --with-freetype --with-jpeg --with-png --with-zlib --with-libxml-dir --with-curl --with-mhash --with-openssl --with-xmlrpc --with-bz2 --with-gettext --with-xsl --with-zip --with-pear --enable-bcmath --enable-mysqlnd --enable-inline-optimization --enable-sockets --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --enable-gd --enable-exif --enable-calendar --enable-shmop --enable-sysvsem --with-curl --with-mhash --with-openssl --with-xmlrpc --with-bz2 --with-gettext --with-xsl --with-zip --with-pear --enable-bcmath --enable-mysqlnd --enable-inline-optimization --enable-sockets --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --enable-gd --enable-exif --enable-calendar --enable-shmop --enable-sysvsem
make && make install

最新一个报错大致如下

1
2
3
4
5
cli/php_cli_process_title.o -lresolv -lrt -lstdc++ -liconv -lbz2 -lutil -lrt -lm -ldl -lxml2 -lssl -lcrypto -lsqlite3 -lz -lcurl -lxml2 -lssl -lcrypto -lz -lpng15 -ljpeg -lfreetype -licuio -licui18n -licuuc -licudata -lonig -lsqlite3 -lxml2 -lxml2 -lxml2 -lxml2 -lxslt -lz -ldl -lm -lxml2 -lexslt -lxslt -lz -lm -lgcrypt -ldl -lgpg-error -lxml2 -lzip -lbz2 -lz -lz -lssl -lcrypto -lrt -o sapi/cli/php
ext/zip/zip_stream.o: In function `php_stream_zip_opener':
/root/lnmp1.8-full/src/php-8.3.25/ext/zip/zip_stream.c:347: undefined reference to `zip_file_is_seekable'
ext/zip/zip_stream.o: In function `php_stream_zip_open':
/root/lnmp1.8-full/src/php-8.3.25/ext/zip/zip_stream.c:261: undefined reference to `zip_file_is_seekable'

 

 

放弃

php 编译依旧是各种报错,放弃高版本升级,先恢复平台访问,下次再升级吧。

这里退回 8.0.30 倒是很顺利。

./upgrade.sh php

Current PHP Version:  这里直接提示没版本了
You can get version number from http://www.php.net/
Please enter a PHP Version you want: 8.0.30

。。。

Installing PEAR environment: /usr/local/php/lib/php/
[PEAR] Archive_Tar - installed: 1.4.14
[PEAR] Console_Getopt - installed: 1.4.3
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.4.5
warning: pear/PEAR dependency package "pear/Archive_Tar" installed version 1.4.14 is not the recommended version 1.4.4
[PEAR] PEAR - installed: 1.10.13
Warning! a PEAR user config file already exists from a previous PEAR installation at '/root/.pearrc'. You may probably want to remove it.
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/lnmp1.8-full/src/php-8.0.30/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin/phar.phar
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers: /usr/local/php/include/php/ext/pdo/
Copy new php configure file...
Modify php.ini......
config-set succeeded
config-set succeeded
Downloading Composer...
--2025-10-13 10:37:59-- https://soft.vpser.net/web/php/composer/composer.phar
Resolving soft.vpser.net (soft.vpser.net)... failed: Name or service not known.
wget: unable to resolve host address ‘soft.vpser.net’
Composer install failed, try to from composer official website...
All settings correct for using Composer
Downloading...

Composer (version 2.8.12) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

Composer install successfully.
Install ZendGuardLoader for PHP 8...
unavailable now.
Creating new php-fpm configure file...
Copy php-fpm init.d file...
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Starting LNMP...
Starting nginx... done
Starting MySQL... SUCCESS!
Starting php-fpm done
======== upgrade php completed ======

 

 

相关文章:

  1. 安装Nginx
  2. 你的网站到底是慢在哪里?
  3. 小站已经被alexa收录啦,哈哈
  4. 利用十六进制及十进制地址转换突破局域网ip或域名封锁
标签: 521 cmake libiconv libzip LNMP openssl php PHP 8.0.30 PHP 8.3.25 PHP 升级 zip_file_is_seekable
最后更新:24 10 月, 2026

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.

归档
分类
  • network / 337篇
  • Uncategorized / 117篇
  • unix/linux / 128篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 14篇
  • 美剧 / 3篇
  • 美图共赏 / 21篇
  • 英语学习 / 3篇
标签聚合
wget brew unveiled today dreamhost Google Adwords Opera Mini 网通 Ubuntu Nginx kubectl 邮件归档 docker 职责 d90 gitlab deepseek 虚拟主机 openssl Google Voice 泰国 kernel 网站运营 nexus Linux VPS squid Google postgres k8s ldap

COPYRIGHT © 2008-2026 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang