Install php8.2-gmp PHP module

I am running Debian 12 with PHP 8.2. I am attempting to install php8.2-gmp PHP module. So I tried:

apt-get install php8.2-gmp

There was a problem with the sury key being expired in February. See this issues page:

So I went to the sury issues page and they suggested installing this fake key:

apt install debsuryorg-archive-keyring

But the fake key would not install due to a cache problem. I learned that the sury package caches are in /var/lib/apt/lists/. So I deleted all four sury files and tried to install the fake archive key again.

apt install debsuryorg-archive-keyring

This time the fake archive key was installed. I then tried to install the GMP module:

apt-get install php8.2-gmp

I learned that there was a dependency. I first need to install php8.2-common. So I tried

apt-get install php8.2-common

The reply was it is already the newest version 8.2.10. It turns out

php8.2-gmp depends on an older version of php8.2-common (= 8.2.7-1~deb12u1).

I figured out how to install the older version with:

wget ‘http://ftp.de.debian.org/debian/pool/main/p/php8.2/php8.2-common_8.2.7-1~deb12u1_amd64.deb’ && dpkg --install php8.2-common_8.2.7-1~deb12u1_amd64.deb

The above command worked. But it led to a broken package.

E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution). So I tried

apt --fix-broken install.

The reply was that the following packages will be REMOVED:

php8.2 php8.2-apcu php8.2-bcmath php8.2-bz2 php8.2-cli php8.2-curl php8.2-fpm

php8.2-gd php8.2-imagick php8.2-imap php8.2-intl php8.2-ldap php8.2-mbstring

php8.2-mysql php8.2-opcache php8.2-pspell php8.2-readline php8.2-soap php8.2-xml

php8.2-zip

I am pretty certain that getting rid of all of these modules would crash my server. So I typed n for no.

I am hoping someone here might have an idea for how I can install the php8.2-gmp PHP module.

Here you also had a fix:

Before the apt-get install you should execute apt update

Uff, you messed it up.

Before continue, if your hosting provider allows to make a snapshot to your server, do it.

You must uninstall that package php8.2-common_8.2.7-1~deb12u1_amd64.deb

dpkg --remove php8.2-common

I don’t know if you can do it cleanly but if the package can be removed, try to update and reinstall the packages.

apt update
apt install php8.2-common php8.2-gmp

Good luck.

1 Like

The only backup I have is a Hestia backup from earlier today. What is the command I need to use to restore from that backup?

After looking into it, I just clicked on the Backup restore from the backup, restore all. Hopefully, this will take care of the problem.

That won’t fix the problem. Restoring an Hestia backup won’t change the installed packages.

You were right. Restoring from the Hestia backup did not roll back the packages. So I tried to install the correct keyring with this:

curl -sSlo /usr/share/keyrings/sury-keyring.gpg https://packages.sury.org/php/apt.gpg

curl -sSlo /usr/share/keyrings/apache2-keyring.gpg https://packages.sury.org/apache2/apt.gpg

Then I did the update:

apt update

Then I tried to remove php8.2 common with this:

dpkg --remove php8.2-common

It could not be removed due to this: error processing package php8.2-common (–remove): dependency problems - not removing.

So I tried to install

apt install php8.2-common php8.2-gmp

But I got this error:
Errors were encountered while processing: php8.2-common

The following packages have unmet dependencies:

php8.2-bcmath : Depends: php8.2-common (= 8.2.10-1+0~20230904.33+debian12~1.gbp2dc84c) but 8.2.17-1+0~20240322.50+debian12~1.gbpc3bdbd is to be installed

I then tried to install

apt install php8.2-gmp

and got the same error.

Unless I can find a way to resolve this problem, is my only option to start over and rebuild the server? Either way, thank you for your input. I greatly appreciate your help.

apt purge php8.2-*

And then install php gain?

3 Likes

That could be resolved adding --force-depends option to dpkg command but at this point, I think you should follow @eris advise, purge all php8.2 packages and reinstall php-8.2.

apt purge php8.2-*
v-add-web-php 8.2
apt install php8.2-gmp
2 Likes

Thanks for the tip. It may come in handy in the future. In my case, I decided to simply rebuild the server.