Service httpd status: httpd dead but subsys locked, but pid exists

Some times we get the error like httpd dead but subsys locked, but pid exists. Please follow thebelow steps to resolve the issue.

# service httpd status
httpd dead but subsys locked


1) Kill all the Apache process

# ipcs -s apache  (looking for  the locked PIDs of apache)

# ipcs -s | grep apache | perl -e ‘while (<STDIN>) { @a=split(/s+/);print `ipcrm sem $a[1]`}’ (deleting the resources)

# cd /var/lock/subsys ( deleting the lock from the subsys folder)

# rm httpd

# service httpd restart

2) If the above is not fixing then try the following.

Comment out the following module in your httpd.conf and restart apache

# LoadModule unique_id_module modules/

# /etc/init.d/httpd restart