Apache hangs when trying to restart on Centos

I have a clean install of CENTOS 8 and installed Apache in it. So I created a script with only this code below (named “test.php”) and I execute it calling the script in my browser (like localhost/test.php):

<?php

set_time_limit(0); 

sleep(10000000);

?>

After acessing this file on my browser, if I try to restart Apache with the command systemctl restart httpd my SSH hangs for at least 2 or 3 minutes before actually restarting the server. The problem, is that meanwhile, the entire server gets offline! The entire server gets offline while apache is “trying” to restart.

So I ask you: how do I force a restart of apache without having to wait it? Sometimes it’s even faster restarting the entire server with shutdown -r now since systemctl restart httpd.service takes so long.

I think this is a bug since Apache should not hang undefinately if the super user wants it to restart right away!

Read more here: Source link