httpd dead but pid file exists

Your Apache is not working because it gives following error :
httpd dead but pid file exists

You have tried to restart Apache several times but still it gives same error.
To remove this error, you need to remove Semaphore Arrays of Apache.

Find all Semaphore Arrays of Apache. Run following command in terminal.
ipcs -s | grep apache
Now remove each entry using command
ipcrm -s semid
semid is second column of the table.

If there are multiple entries of Apache and it is difficult to remove each entry individually, Run following command.
for i in `ipcs -s | grep apache | awk '{ print $2 }'` ; do ipcrm -s $i ; done;
If it is not working for you, Run
ipcs -s | grep apache |  perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
Now restart Apache. Run following command.
service httpd restart 

Solution : 2
If still you are facing same error after restarting Apache. Run
rm /var/lock/subsys/httpd
and Run
rm /var/run/httpd/
Now restart Apache again.
service httpd restart 
Now what is Semaphore Array
A semaphore is a variable or abstract data type that is used for controlling access, by multiple processes.
In its simplest form a semaphore is a location in memory whose value can be tested and set by more than one process. 
ipcs  provides  information on the ipc facilities for which the calling process has read access.
-s displays semaphore arrays.
ipcrm removes a message queue, semaphore set or shared memory id.


  1. This is good guide !!! Thanks a lot Helped me lot !

  2. I dont have any Semaphore Arrays of Apache in my PC, tried 2nd step too, neither worked :(


Related Posts Plugin for WordPress, Blogger...