The last days I had on my server a very strange issue, when I found that Apache (version 1.3.39) was restarting at random times, usually every 1 or 2 minutes. Although it did not affect the loading of pages or images, it caused big problems when somebody was downloading big files from my site, as the download was interrupted when Apache was restarted.
Nothing strange was appearing in the error_log file, just "SIGHUP received" and then Apache restarting with no errors.
I followed the following steps that did not help:
- Temporarily stopped crond in case there was a cron script restarting Apache
- Stopped chksrvd in case it could not connect to HTTP service, thinking it was down and restarting it
- Disabled the firewall, in case it blocked local connections, making Apache appearing dead (it had happened to me some months ago so I did it just in case...).
- Added 127.0.0.1 and my server's IP to the firewall allow range
- Uninstalled PRM, SPRI and other similar monitoring scripts, as they could be restarting Apache
- Scanned the server for rootkits and viruses. Nothing found.
- Recompiled and reinstalled Apache, PHP and all modules through cPanel 11
Nothing of the above helped. Apache keeped restarting every minute and I started being frustrated. Finally I decided to try a final step, as a temporary workaround.
Yes, I know it is a dirty trick, so... do not try this at home or at your server... :D
I edited the files /usr/local/apache/bin/apachectl and /etc/init.d/httpd so as the command "restart" could not be used. Now if somebody needs to restart Apache, he must type another command instead of restart. After this, Apache has been working now for 18 hours without any restart, loading pages as fast as always and without any problems or errors.
So there is definitely something running the command /usr/local/apache/bin/apachectl restart or /etc/init.d/httpd restart but I can't find what else it could be, other than all the possible reasons I checked above. I have to restore, as soon as possible, the original httpd and apachectl files with the working "restart" command, so I have to find what script runs this command and disable it. Any idea?
Nothing strange was appearing in the error_log file, just "SIGHUP received" and then Apache restarting with no errors.
I followed the following steps that did not help:
- Temporarily stopped crond in case there was a cron script restarting Apache
- Stopped chksrvd in case it could not connect to HTTP service, thinking it was down and restarting it
- Disabled the firewall, in case it blocked local connections, making Apache appearing dead (it had happened to me some months ago so I did it just in case...).
- Added 127.0.0.1 and my server's IP to the firewall allow range
- Uninstalled PRM, SPRI and other similar monitoring scripts, as they could be restarting Apache
- Scanned the server for rootkits and viruses. Nothing found.
- Recompiled and reinstalled Apache, PHP and all modules through cPanel 11
Nothing of the above helped. Apache keeped restarting every minute and I started being frustrated. Finally I decided to try a final step, as a temporary workaround.
Yes, I know it is a dirty trick, so... do not try this at home or at your server... :D
I edited the files /usr/local/apache/bin/apachectl and /etc/init.d/httpd so as the command "restart" could not be used. Now if somebody needs to restart Apache, he must type another command instead of restart. After this, Apache has been working now for 18 hours without any restart, loading pages as fast as always and without any problems or errors.
So there is definitely something running the command /usr/local/apache/bin/apachectl restart or /etc/init.d/httpd restart but I can't find what else it could be, other than all the possible reasons I checked above. I have to restore, as soon as possible, the original httpd and apachectl files with the working "restart" command, so I have to find what script runs this command and disable it. Any idea?
Last edited: