How to delete and install php 8.2 onto Hestia server

I am running Hestia 1.9.6 on a Debian 11.9 VPS. I have some websites that I am trying to update from PHP 8.1 to PHP 8.2. I went to a website account and clicked the Edit Pencil. Then I clicked Advanced Options and changed the backend template from PHP 8.1 to PHP 8.2. Unfortunately, after clicking save, the website displayed a 500 error. I therefore changed it back to PHP 8.1 to display the website again.

I read that the problem was likely due to a broken PHP 8.2 install. I therefore made sure that no other website on the server was using PHP 8.2. I then opened a terminal and attempted to delete PHP 8.2 with this command as root:

v-delete-web-php 8.2

The terminal replied with "Uninstallation failed, please run the following command manually for debugging:

apt-get purge php8.2-common php8.2-mbstring php8.2-bcmath php8.2-cli php8.2-curl

php8.2-fpm php8.2-gd php8.2-intl php8.2-mysql

php8.2-soap php8.2-xml php8.2-zip php8.2-mbstring

php8.2-json php8.2-bz2 php8.2-pspell php8.2-imagick php8.2-pgsql

php8.2-imap php8.2-ldap php8.2-apcu

I did this which appeared to uninstall PHP 8.2. I then reinstalled PHP 8.2 with this command:

v-add-web-php 8.2

I then used Hestia settings to restart PHP 8.2 and Apache and NginX.

I then tried again to change the website from PHP 8.1 to PHP 8.2 but I got the same 500 error.

I am wondering how to fix this problem. Any ideas would be appreciated.

Show the output of these commands:

dpkg -l | grep -E "^ii\s+*php(.\..)?-fpm"
apache2ctl -M

Try to access your web site to generate again the 500 error and check the nginx and apache log:

tail -n30 /var/log/nginx/error.log
tail -n30 /var/log/apache2/error.log

dpkg -l | grep -E “^ii\s+*php(.\..)?-fpm”

ii php7.4-fpm 1:7.4.33-8+0~20230904.88+debian11~1.gbp87c414 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php8.1-fpm 8.1.21-1+0~20230716.45+debian11~1.gbpbeb527 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)
ii php8.2-fpm 8.2.31-1~deb12u1 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary)

apache2ctl -M

Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
fcgid_module (shared)
filter_module (shared)
status_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
proxy_module (shared)
proxy_fcgi_module (shared)
remoteip_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
suexec_module (shared)

Access your web site to generate again the 500 error and check the nginx and apache log:

tail -n30 /var/log/nginx/error.log

2026/06/18 22:38:12 [warn] 839153#839153: "ssl_stapling" ignored, no OCSP responder URL in the certificate "/home/bfa02/conf/mail/freedica.org/ssl/freedica.org.pem"

tail -n30 /var/log/apache2/error.log

[Fri Jun 19 04:32:03.924626 2026] [proxy_fcgi:error] [pid 995132:tid 140428737222336] [client 20.151.2.122:0] AH01071: Got error 'Primary script unknown'
[Fri Jun 19 05:35:16.705381 2026] [proxy_fcgi:error] [pid 1002470:tid 140429634750144] [client 104.219.236.111:0] AH01071: Got error 'Primary script unknown'
[Fri Jun 19 05:40:43.256447 2026] [mpm_event:notice] [pid 991454:tid 140429885888384] AH00493: SIGUSR1 received. Doing graceful restart
[Fri Jun 19 05:40:43.646591 2026] [ssl:warn] [pid 991454:tid 140429885888384] AH01909: 66.209.180.237:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jun 19 05:40:43.648482 2026] [mpm_event:notice] [pid 991454:tid 140429885888384] AH00489: Apache/2.4.57 (Debian) mod_fcgid/2.3.9 OpenSSL/1.1.1w configured -- resuming normal operations
[Fri Jun 19 05:40:43.648525 2026] [core:notice] [pid 991454:tid 140429885888384] AH00094: Command line: '/usr/sbin/apache2'
[Fri Jun 19 05:40:45.154012 2026] [mpm_event:notice] [pid 991454:tid 140429885888384] AH00493: SIGUSR1 received. Doing graceful restart
[Fri Jun 19 05:40:45.964988 2026] [ssl:warn] [pid 991454:tid 140429885888384] AH01909: 66.209.180.237:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jun 19 05:40:45.967853 2026] [mpm_event:notice] [pid 991454:tid 140429885888384] AH00489: Apache/2.4.57 (Debian) mod_fcgid/2.3.9 OpenSSL/1.1.1w configured -- resuming normal operations
[Fri Jun 19 05:40:45.967924 2026] [core:notice] [pid 991454:tid 140429885888384] AH00094: Command line: '/usr/sbin/apache2'

Thanks for your help.

That package doesn’t look like a Sury PHP package and the distro is Debian 12 instead of Debian 11.

Show these commands (when pasting the output, select the text and click on button </> to format the output correctly):

dpkg -l | grep-E 'php-fpm|php8.2-fpm'
apt show php8.2-fpm -a
cat /etc/apt/sources.list.d/php.list
cat /etc/apt/sources.list.d/apache2.list
apt update
apt show php8.2-fpm -a




Package: php8.2-fpm

Version: 8.2.31-1~deb12u1

Priority: optional

Section: php

Source: php8.2

Maintainer: Debian PHP Maintainers <[email protected]>

Installed-Size: 5752 kB

Provides: php-fpm, php-json, php8.2-json, phpapi-20220829

Depends: libmagic1, media-types | mime-support, php8.2-cli, php8.2-common (= 8.2.31-1~deb12u1), php8.2-opcache, procps, systemd | systemd-tmpfiles, tzdata, ucf, libacl1 (>= 2.2.23), libapparmor1 (>= 2.7.0~beta1+bzr1772), libargon2-1 (>= 0~20171227), libc6 (>= 2.35), libpcre2-8-0 (>= 10.32), libsodium23 (>= 1.0.18), libssl3 (>= 3.0.0), libsystemd0, libxml2 (>= 2.8.0), zlib1g (>= 1:1.1.4)

Suggests: php-pear

Homepage: http://www.php.net/

Download-Size: 1747 kB

APT-Manual-Installed: yes

APT-Sources: 
 bookworm/main amd64 Packages

Description: server-side, HTML-embedded scripting language (FPM-CGI binary)

This package provides the Fast Process Manager interpreter that runs

as a daemon and receives Fast/CGI requests. Note that MOST Apache users

probably want the libapache2-mod-php8.2 package.




The following extensions are built in: Core date filter hash json libxml

openssl pcre random Reflection session sodium SPL standard zlib.

.

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used

open source general-purpose scripting language that is especially suited

for web development and can be embedded into HTML.




Package: php8.2-fpm

Version: 8.2.15-1+0~20240120.39+debian11~1.gbp56f296

Priority: optional

Section: php

Source: php8.2

Maintainer: Debian PHP Maintainers <[email protected]>

Installed-Size: 5727 kB

Provides: php-fpm, php-json, php8.2-json, phpapi-20220829

Depends: libmagic1, media-types | mime-support, php8.2-cli, php8.2-common (= 8.2.15-1+0~20240120.39+debian11~1.gbp56f296), php8.2-opcache, procps, systemd | systemd-tmpfiles, tzdata, ucf, libacl1 (>= 2.2.23), libapparmor1 (>= 2.7.0~beta1+bzr1772), libargon2-1 (>= 0~20171227), libc6 (>= 2.29), libpcre2-8-0 (>= 10.38), libsodium23 (>= 1.0.18), libssl1.1 (>= 1.1.1), libsystemd0, libxml2 (>= 2.8.0), zlib1g (>= 1:1.1.4)

Suggests: php-pear

Homepage: http://www.php.net/

Download-Size: 1720 kB

APT-Sources: https://packages.sury.org/php bullseye/main amd64 Packages

Description: server-side, HTML-embedded scripting language (FPM-CGI binary)

This package provides the Fast Process Manager interpreter that runs

as a daemon and receives Fast/CGI requests. Note that MOST Apache users

probably want the libapache2-mod-php8.2 package.

.

The following extensions are built in: Core date filter hash json libxml

openssl pcre random Reflection session sodium SPL standard zlib.

.

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used

open source general-purpose scripting language that is especially suited

for web development and can be embedded into HTML.










cat /etc/apt/sources.list.d/php.list




deb [arch=amd64 signed-by=/usr/share/keyrings/sury-keyring.gpg] 
 bullseye main




cat /etc/apt/sources.list.d/apache2.list

deb [arch=amd64 signed-by=/usr/share/keyrings/apache2-keyring.gpg] 
 bullseye main







apt update




Hit:1 
 bookworm InRelease

Hit:2 
 bookworm-security InRelease

Hit:3 
 bookworm-updates InRelease

Hit:4 
 bookworm-backports InRelease

Get:5 https://packages.sury.org/apache2 bullseye InRelease [6070 B]

Hit:6 https://apt.hestiacp.com bullseye InRelease

Get:7 https://packages.sury.org/php bullseye InRelease [6136 B]

Get:8 
 bullseye InRelease [3296 B]

Err:5 https://packages.sury.org/apache2 bullseye InRelease

The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

Err:7 https://packages.sury.org/php bullseye InRelease

The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

Err:8 
 bullseye InRelease

The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2FD21310B49F6B46

Hit:9 
 bullseye InRelease

Fetched 3296 B in 6s (524 B/s)

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

567 packages can be upgraded. Run 'apt list --upgradable' to see them.

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/apache2 bullseye InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php bullseye InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: 
 bullseye InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2FD21310B49F6B46

W: Failed to fetch https://packages.sury.org/apache2/dists/bullseye/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: Failed to fetch https://nginx.org/packages/mainline/debian/dists/bullseye/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2FD21310B49F6B46

W: Failed to fetch https://packages.sury.org/php/dists/bullseye/InRelease The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key <[email protected]>

W: Some index files failed to download. They have been ignored, or old ones used instead.

Let’s fix your repos:

First purge php8.2-fpm packages:

apt purge "php8.2-fpm*"

Now execute these commands:

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
apt update
v-add-web-php 8.2
systemctl restart nginx apache2 php8.2-fpm

And check your site again.