diff --git a/src/initscripts/system/apache b/src/initscripts/system/apache
index 18eb86e2f..087e4084e 100644
--- a/src/initscripts/system/apache
+++ b/src/initscripts/system/apache
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -87,6 +87,16 @@ case "$1" in
 	stop)
 		boot_mesg "Stopping Apache daemon..."
 		/usr/sbin/apachectl -k stop
+		COUNTER=0
+		while [ -e /var/run/httpd.pid ]
+		do
+			sleep 1
+			(( COUNTER++ ))
+			if [ $COUNTER -eq 10 ]; then
+				boot_mesg "pid not removed after 10 seconds"
+				break
+			fi
+		done
 		evaluate_retval
 		;;
 
