PHP Fatal error: Class ‘ZipArchive’ not found in报错需要安装一下apt-get install php-zip,却报错了
eading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
libzip4 php7.3-zip
The following NEW packages will be installed:
libzip4 php-zip php7.3-zip
0 upgraded, 3 newly installed, 0 to remove and 113 not upgraded.
Need to get 78.1 kB of archives.
After this operation, 246 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://mirrors.cloud.aliyuncs.com/debian buster/main amd64 libzip4 amd64 1.5.1-4
404 Not Found [IP: 100.100.2.148 80]
Err:2 http://mirrors.cloud.aliyuncs.com/debian-security buster/updates/main amd64 php7.3-zip amd64 7.3.31-1~deb10u7
404 Not Found [IP: 100.100.2.148 80]
原因看到是由于Debian官方将Debian10(Debian buster)软件源由默认站点deb.debian.org移至存档站点archive.debian.org,基于官方软件源的镜像站同步了这一修改, 导致20250723之前的Debian10镜像在运行apt update命令时会报错: buster Release 404 Not Found 。
解决方法是:切换至Debian归档仓库(维持Buster)
适用场景:需保留Debian 10环境,不升级系统。
cd /etc/apt/;cp sources.list sources.list_bak
1、修改镜像源为官方归档地址:
deb https://archive.debian.org/debian buster main contrib non-free
deb-src https://archive.debian.org/debian buster main contrib non-free
deb https://archive.debian.org/debian-security buster/updates main contrib non-free
deb-src https://archive.debian.org/debian-security buster/updates main contrib non-free
deb https://archive.debian.org/debian buster-updates main contrib non-free
deb-src https://archive.debian.org/debian buster-updates main contrib non-free或者阿里云镜像软件源
deb https://mirrors.aliyun.com/debian-archive/debian buster main contrib non-free
deb-src https://mirrors.aliyun.com/debian-archive/debian buster main contrib non-free
deb https://mirrors.aliyun.com/debian-archive/debian-security buster/updates main contrib non-free
deb-src https://mirrors.aliyun.com/debian-archive/debian-security buster/updates main contrib non-free
deb https://mirrors.aliyun.com/debian-archive/debian buster-updates main contrib non-free
deb-src https://mirrors.aliyun.com/debian-archive/debian buster-updates main contrib non-freesudo apt update
sudo apt install <软件包名> –allow-unauthenticated # 忽略证书警告
再试试:sudo apt-get install php-zip
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
libzip4 php7.3-zip
The following NEW packages will be installed:
libzip4 php-zip php7.3-zip
0 upgraded, 3 newly installed, 0 to remove and 113 not upgraded.
Need to get 78.1 kB of archives.
After this operation, 246 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
 
 