Tuesday, November 05, 2013

httpd dead but pid file exists – Apache Service Status

There may be the case when httpd(Apache) service gets stuck, Follow the steps below to resolve them.

/etc/init.d/httpd status

While trying to check status of apache if you are getting the error below follow the steps.

========================
httpd dead but pid file exists
======================

step 1: Check if some other process is using port 80 as it is a port for httpd service.

netstat -tulpn | grep :80

If the output of command is like below follow directly step 3 now else follow step 2 only if any other process than httpd is using that port and the issue will be resolved no need to go for step 3 and other.

==================================
tcp    0     0   :::80   :::*     LISTEN    8448/httpd
==================================

Step 2: kill -9 PID

*Note 8448 is the process id in above case it will change in your system.

service httpd restart

Step 3: Check Apache running processes.

ipcs -s | grep apache

=========================
0x00000000 262152     apache    600        1
0x00000000 294921     apache    600        1
0x00000000 327690     apache   600        1
=========================

Step 4: Kill the processes using following command.


# ipcs -s | grep apache |  perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}'


Step 5: Remove httpd lock file

rm -f /var/lock/subsys/httpd

Step 6: Restart Apache Service.

service httpd restart

2 comments:

Shashank said...

Your link was on the second page but really very good resolution tooo good :-)

Unknown said...

Thanx Shashank..... :-)

Post a Comment

Do Write about the Blog and Welcome to the world where open source is every thing :-)