首页 > 解决方案 > Install redis extension for php 7.4 on Debian server

问题描述

I'd like to install php7.4-redis on my debian server. My php is 7.4 version.

When I run the "sudo apt install php7.4-redis" command , it shows 404 not found so I can't finish my setting.

However , I found the page has other version : php7.4-redis version

I've run command "sudo apt-get update" to update the repository but why am I still getting the 404 error?

sudo apt install php7.4-redis
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
php7.4-igbinary
The following NEW packages will be installed:
php7.4-igbinary php7.4-redis
0 upgraded, 2 newly installed, 0 to remove and 70 not upgraded.
Need to get 142 kB/202 kB of archives.
After this operation, 848 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 https://packages.sury.org/php stretch/main amd64 php7.4-redis amd64 5.3.2+4.3.0-7+0~20210228.34+debian9~1.gbp893bd4
404  Not Found
E: Failed to fetch https://packages.sury.org/php/pool/main/p/php-redis/php7.4-redis_5.3.2+4.3.0-7+0~20210228.34+debian9~1.gbp893bd4_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

标签: phpredisdebianphp-7.4phpredis

解决方案


尝试运行apt update,然后它应该可以工作。

APT 在运行时会在本地缓存每个存储库中可用的包apt update。如果你安装一个包,apt 将使用这个缓存。但是,当服务器上的软件包更新并且旧版本被删除时,apt 将尝试检索不再存在的文件。此日志输出表明了这一点:

404  Not Found
E: Failed to fetch https://packages.sury.org/php/pool/main/p/php-redis/php7.4-redis_5.3.2+4.3.0-7+0~20210228.34+debian9~1.gbp893bd4_amd64.deb  404  Not Found

如果您查看repos 列表,您的版本5.3.2+4.3.0-7+0~20210228.34+debian9~1.gbp893bd4明显丢失。因此,经过一个apt updateapt 后就会知道从哪里加载包。

编辑:您的系统上有一个来自 php sury 的旧签名密钥,因此无法更新 repo 并且无法获取要下载的当前版本。这是一个已知问题,我在所有主机上都遇到过。

在链接的 GitHub 线程中,建议的修复是简单地运行这些命令(由 stefanux 发布):

$ apt-key del 95BD4743 # If this throws an error about the key not being present, it's fine
$ wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
$ apt-get update

现在你应该可以安装 redis 包了。


推荐阅读