r/debian • • 5d ago

Debian 13: Apache not restarted after PHP updates – known bug apparently still present

I'm running a web server with Debian 13 (Trixie), Apache 2.4.71 and PHP 8.3 using mod_php. The PHP packages come from the Sury repository and are automatically updated through unattended-upgrades.

I first noticed during the PHP2Shell security updates that Apache was not automatically restarted after the PHP updates had been installed. Last night, unattended-upgrades once again installed several updates for libapache2-mod-php8.3 and other PHP extensions, but Apache was not restarted afterward.

For example, at around 06:14 this morning, several PHP 8.3 packages were updated, including libapache2-mod-php8.3 and php8.3-opcache. However, the Apache main process was still running since the previous evening, when I had manually installed the first round of updates and restarted Apache myself:

ExecMainStartTimestamp=Thu 2026-11-19 22:18:18 CET
ActiveEnterTimestamp=Thu 2026-11-19 22:18:18 CET

After doing some research, I found that this is a known issue and was supposedly fixed in Apache 2.4.65-3 back in August 2025:

Debian bug report #1060450:
https://bugs.debian.org/1060450

However, the problem apparently still exists in Debian 13. A new bug report was filed in October 2026:

https://bugs.debian.org/1151638

The cause seems to be in the apache2_needs_action() function in /usr/share/apache2/apache2-maintscript-helper, which handles the configure method but not triggered.

I checked the installed script on my server, which is running Apache package version 2.4.71-1~deb13u1. The relevant section still looks like this:

postinst)
    if [ "$APACHE2_MAINTSCRIPT_METHOD" = "configure" ] ; then
        # act on fresh installs
        [ -z "$APACHE2_MAINTSCRIPT_ARGUMENT" ] && return 0
        # act if someone told us
        [ -n "$APACHE2_NEED_ACTION" ] && return 0
    fi
    ;;

Unless I'm missing something, it seems that the fix already made in Debian's Apache packaging has still not been included in the Debian 13 stable packages.

From my point of view, this is a potential security issue. Although the updated PHP packages are installed, running Apache processes may continue using the old PHP libraries until Apache is restarted.

Has anyone found a workaround for this issue, or have I missed an update on my server that would fix the bug?

19 Upvotes

16 comments sorted by

5

u/Educational_Bee_6245 5d ago

Does the needrestart package covers this case? It is highly useful.

2

u/Cyberduck_de 4d ago

Thanks for the suggestion! needrestart was indeed not installed on my server.

I've installed it now and configured it to run in list-only mode. I'll monitor how it behaves over the next few updates, particularly whether it reliably detects Apache after PHP module updates.

The server was originally set up with Debian 10 and has been upgraded through several Debian releases to Debian 13. I wonder if that explains why needrestart was never installed. Perhaps it wasn't part of the default installation back then.

Thanks again for pointing me in this direction!

1

u/Cyberduck_de 3d ago

Looks like it works! This morning, unattended-upgrades installed another batch of PHP updates, including several modules.

The package update mechanism still didn't restart Apache automatically, but needrestart correctly detected that a restart was needed:

$ sudo needrestart
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Services to be restarted:
 systemctl restart apache2.service

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

So it seems to do exactly what I was looking for. I'll keep it in list-only mode for now and see how it goes.

I've also sent my findings to the Debian bug tracker (#1151638), including the results from today's updates.

Thanks again for the tip!

1

u/hmoff 4d ago

Switch to fpm instead of the Apache module.

1

u/Cyberduck_de 4d ago

PHP-FPM might actually be an interesting approach. However, switching to PHP-FPM would be quite a big change on my production server, just to work around a relatively small issue for which I may already have found a solution. My current setup has been running reliably for years, so I'd rather not make such a change just because of this bug. But I'll definitely take a closer look at PHP-FPM and keep it in mind when setting up another server in the future.

Thx CD

2

u/hmoff 1d ago

It’s a better architecture anyway. I had to switch years ago because the PHP module wasn’t compatible with the mpm module I wanted to use.

1

u/TCB13sQuotes 19h ago edited 19h ago

I don’t think anyone running anything serious isn’t on PHP-FPM at this point. No Apache restart required. You can even run a separate PHP stack for each website / application in a container and have the Apache instance route the requests to the right place. Secure and clean.

1

u/Nuke_Bloodaxe 4d ago

That's a very good suggestion, but with the caveat he'll need to restart to ensure the fpm processes are restarted too. Or, he could be sensible, script updates hourly and have the daily or faster system backup routine shutting down the VM to start taking the backup; this is fast if the filesystem is COW.

2

u/hmoff 4d ago

The post install script for the fpm package still restart the new version safely.

1

u/Nuke_Bloodaxe 4d ago

Just be a bit careful, not all of them do, so I keep a suggestion of play it safe.

0

u/cyh555 4d ago

Hire an sysadmin to do the job right, smh

4

u/jmtd [DD] 5d ago

Switch to the official PHP packages, which have the security fixes?

-1

u/elivoncoder Debian Sid 4d ago

while not directly related to your question, take this opp to try out another webserver, ie nginx or lightty.

2

u/xonxoff 4d ago

Nginx also just had some CVE come out, you’ll need to verify those have been patched as well.

2

u/IncendiaryIdea 4d ago

What's wrong with Apache?

0

u/elivoncoder Debian Sid 4d ago

nothing that I know of, maybe just a chance to try another.