phpredisdebianphp-7.4phpredis

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?

Solution

  • Try running apt update, then it should work afterwards.

    APT caches the packages available from each repository locally when running apt update. If you install a package, apt will use this cache. However, when a package is updated on the server and the old version gets deleted, apt will try to retrieve a no longer present file. This is indicated by this log output:

    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
    

    If you take a look at the repos listing, your Version 5.3.2+4.3.0-7+0~20210228.34+debian9~1.gbp893bd4 is notably missing. Thus, after an apt update apt will know from where to load the package.

    EDIT: You have an old signing key from php sury on your system, thus the repo can not be updated and the current version to download can not be obtained. This is a known issue, I faced it to on all my hosts.

    In the linked GitHub thread, the recommended fix was to simple run these commands (posted by 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
    

    Now you should be able to install the redis package.