can't restart httpd service smoothly

I have an apache server which has some problem for restarting. Everytime I restart it, it threw me into error as below.

Formerly I didn't need kill the process running on port 80. I don't know why the port 80 is still being used when I stop the service.

thanks.


[root@point ~]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]
[root@point ~]# service httpd stop
Stopping httpd:                                            [FAILED]
[root@point ~]# service httpd status
httpd is stopped
[root@point ~]# service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]
[root@point ~]# netstat -ltnp | grep ':80'
tcp        0      0 :::80                       :::*                        LISTEN      3969/httpd
[root@point ~]# ps -ef | grep 3969
root      3969     1  0 Apr29 ?        00:00:28 /usr/sbin/httpd -k start
apache    3970  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
apache    3971  3969  0 Apr29 ?        00:00:01 /usr/sbin/httpd -k start
apache    3972  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
apache    3973  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
apache    3974  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
apache    3975  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
apache    3976  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
apache    3977  3969  0 Apr29 ?        00:00:00 /usr/sbin/httpd -k start
root     16735 16616  0 15:53 pts/2    00:00:00 grep 3969
[root@point ~]# fuser -k -n tcp 80
80/tcp:               3969  3970  3971  3972  3973  3974  3975  3976  3977
[root@point ~]# ps -ef | grep 3969
root     16739 16616  0 15:53 pts/2    00:00:00 grep 3969
[root@point ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point ~]# service httpd status
httpd dead but subsys locked
[root@point ~]#

Open in new window

Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason YuAuthor Commented:
The os is redhat 6.6

[root@point ~]# cat /etc/*-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)
Red Hat Enterprise Linux Server release 6.6 (Santiago)
[root@point ~]#
0
savoneCommented:
Make sure all the processes are stopped, then try again.

You should have to kill the processes, you can use apachectl like so:

apachectl stop
0
Dr. KlahnPrincipal Software EngineerCommented:
Agree with the above comment.  apachectl is the best way to deal with the server once it has already been started by the startup command files.
0
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Jan SpringerCommented:
using the "service" command works just fine:

lsof | grep http

find out what is causing the lock
0
arnoldCommented:
Guess is that you gave two instances starting http if you have an HTTPd config error dealing with port 89


Run apachectl configtest
0
gheistCommented:
run
# apachectl configtest
Any warnings?

Most of the times you need to reload apache configuration:
apachectl graceful
which equals
service httpd reload

then check error log - it will tell IF restart is needed to reload changed module.
1
Jason YuAuthor Commented:
[root@point ~]# apachectl configtest
Syntax OK
[root@point ~]#
0
Jason YuAuthor Commented:
[root@point ~]# apachectl graceful
[root@point ~]# apachectl stop
[root@point ~]# service httpd status
httpd dead but subsys locked
[root@point ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point ~]# service httpd status
httpd dead but subsys locked
[root@point ~]#
0
Jason YuAuthor Commented:
I am not sure how to find which process caused the lock, please help.

[root@point ~]# lsof | grep http | more
httpd     18797      root  cwd       DIR              253,1     4096          2 /
httpd     18797      root  rtd       DIR              253,1     4096          2 /
httpd     18797      root  txt       REG              253,1   355232    1841243 /usr/sbin/httpd
httpd     18797      root  mem       REG              253,1    83088    2491345 /usr/lib64/php/modules/zip.so
httpd     18797      root  mem       REG              253,1    44368    2491349 /usr/lib64/php/modules/sqlite3.so
httpd     18797      root  mem       REG              253,1   261392    2491344 /usr/lib64/php/modules/phar.so
httpd     18797      root  mem       REG              253,1   584080    1836282 /usr/lib64/libsqlite3.so.0.8.6
httpd     18797      root  mem       REG              253,1    24640    2491348 /usr/lib64/php/modules/pdo_sqlite.so
httpd     18797      root  mem       REG              253,1    30112    2491352 /usr/lib64/php/modules/pdo_mysql.so
httpd     18797      root  mem       REG              253,1   102456    2491347 /usr/lib64/php/modules/pdo.so
httpd     18797      root  mem       REG              253,1   136832    2491351 /usr/lib64/php/modules/mysqli.so
httpd     18797      root  mem       REG              253,1  1584680    1839230 /usr/lib64/mysql/libmysqlclient.so.16.0.0
httpd     18797      root  mem       REG              253,1    54408    2491350 /usr/lib64/php/modules/mysql.so
httpd     18797      root  mem       REG              253,1    36200    2491343 /usr/lib64/php/modules/json.so
httpd     18797      root  mem       REG              253,1  1843056    2491342 /usr/lib64/php/modules/fileinfo.so
httpd     18797      root  mem       REG              253,1   161664    1839304 /usr/lib64/libssh2.so.1.0.1
httpd     18797      root  mem       REG              253,1   206640    1310838 /lib64/libidn.so.11.6.1
httpd     18797      root  mem       REG              253,1   343088    1839520 /usr/lib64/libcurl.so.4.1.1
httpd     18797      root  mem       REG              253,1    66096    2491341 /usr/lib64/php/modules/curl.so
httpd     18797      root  mem       REG              253,1     9488    2102979 /usr/lib64/apr-util-1/apr_ldap-1.so
httpd     18797      root  mem       REG              253,1    27424    1310748 /lib64/libnss_dns-2.12.so
httpd     18797      root  mem       REG              253,1    65928    1310750 /lib64/libnss_files-2.12.so
httpd     18797      root  mem       REG              253,1    14584    1310766 /lib64/libutil-2.12.so
httpd     18797      root  mem       REG              253,1  1669872    1840545 /usr/lib64/libpython2.6.so.1.0
httpd     18797      root  mem       REG              253,1   152584    1842643 /usr/lib64/httpd/modules/mod_wsgi.so
httpd     18797      root  mem       REG              253,1   181840    1842560 /usr/lib64/httpd/modules/mod_ssl.so
httpd     18797      root  mem       REG              253,1    10192    1310821 /lib64/libkeyutils.so.1.3
httpd     18797      root  mem       REG              253,1    43728    1310831 /lib64/libkrb5support.so.0.1
httpd     18797      root  mem       REG              253,1  1963264    1839148 /usr/lib64/libcrypto.so.1.0.1e
httpd     18797      root  mem       REG              253,1   441112    1839150 /usr/lib64/libssl.so.1.0.1e
httpd     18797      root  mem       REG              253,1    14664    1310788 /lib64/libcom_err.so.2.1
httpd     18797      root  mem       REG              253,1   174840    1310827 /lib64/libk5crypto.so.3.1
httpd     18797      root  mem       REG              253,1   941920    1310829 /lib64/libkrb5.so.3.3
httpd     18797      root  mem       REG              253,1   277704    1310823 /lib64/libgssapi_krb5.so.2.2
httpd     18797      root  mem       REG              253,1  1381472    1836120 /usr/lib64/libxml2.so.2.7.6
httpd     18797      root  mem       REG              253,1   113432    1310744 /lib64/libnsl-2.12.so
httpd     18797      root  mem       REG              253,1    67592    1310792 /lib64/libbz2.so.1.0.4
httpd     18797      root  mem       REG              253,1   374408    1836463 /usr/lib64/libgmp.so.3.5.0
httpd     18797      root  mem       REG              253,1  3699056    1842243 /usr/lib64/httpd/modules/libphp5.so
httpd     18797      root  mem       REG              253,1    10416    1841239 /usr/lib64/httpd/modules/mod_version.so
httpd     18797      root  mem       REG              253,1    27312    1841198 /usr/lib64/httpd/modules/mod_cgi.so
httpd     18797      root  mem       REG              253,1    22992    1841205 /usr/lib64/httpd/modules/mod_disk_cache.so
httpd     18797      root  mem       REG              253,1    10384    1841235 /usr/lib64/httpd/modules/mod_suexec.so
httpd     18797      root  mem       REG              253,1    39664    1841196 /usr/lib64/httpd/modules/mod_cache.so
httpd     18797      root  mem       REG              253,1    14648    1841225 /usr/lib64/httpd/modules/mod_proxy_connect.so
httpd     18797      root  mem       REG              253,1    39632    1841223 /usr/lib64/httpd/modules/mod_proxy_ajp.so
httpd     18797      root  mem       REG              253,1    31472    1841227 /usr/lib64/httpd/modules/mod_proxy_http.so
httpd     18797      root  mem       REG              253,1    35600    1841226 /usr/lib64/httpd/modules/mod_proxy_ftp.so
httpd     18797      root  mem       REG              253,1    27160    1841224 /usr/lib64/httpd/modules/mod_proxy_balancer.so
httpd     18797      root  mem       REG              253,1    85328    1841222 /usr/lib64/httpd/modules/mod_proxy.so
httpd     18797      root  mem       REG              253,1    60464    1841230 /usr/lib64/httpd/modules/mod_rewrite.so
httpd     18797      root  mem       REG              253,1    14608    1841234 /usr/lib64/httpd/modules/mod_substitute.so
httpd     18797      root  mem       REG              253,1    14608    1841178 /usr/lib64/httpd/modules/mod_alias.so
httpd     18797      root  mem       REG              253,1    10448    1841237 /usr/lib64/httpd/modules/mod_userdir.so
httpd     18797      root  mem       REG              253,1    14608    1841232 /usr/lib64/httpd/modules/mod_speling.so
httpd     18797      root  mem       REG              253,1    10416    1841177 /usr/lib64/httpd/modules/mod_actions.so
httpd     18797      root  mem       REG              253,1    10416    1841204 /usr/lib64/httpd/modules/mod_dir.so
httpd     18797      root  mem       REG              253,1    31384    1841221 /usr/lib64/httpd/modules/mod_negotiation.so
httpd     18797      root  mem       REG              253,1    10424    1841240 /usr/lib64/httpd/modules/mod_vhost_alias.so
httpd     18797      root  mem       REG              253,1    52016    1841201 /usr/lib64/httpd/modules/mod_dav_fs.so
httpd     18797      root  mem       REG              253,1    19032    1841214 /usr/lib64/httpd/modules/mod_info.so
httpd     18797      root  mem       REG              253,1    35472    1841195 /usr/lib64/httpd/modules/mod_autoindex.so
httpd     18797      root  mem       REG              253,1    22864    1841233 /usr/lib64/httpd/modules/mod_status.so
httpd     18797      root  mem       REG              253,1    93328    1841200 /usr/lib64/httpd/modules/mod_dav.so
httpd     18797      root  mem       REG              253,1    18800    1841219 /usr/lib64/httpd/modules/mod_mime.so
httpd     18797      root  mem       REG              253,1    14576    1841231 /usr/lib64/httpd/modules/mod_setenvif.so
httpd     18797      root  mem       REG              253,1    14608    1841238 /usr/lib64/httpd/modules/mod_usertrack.so
httpd     18797      root  mem       REG              253,1    18896    1841211 /usr/lib64/httpd/modules/mod_headers.so
httpd     18797      root  mem       REG              253,1    27056    1841203 /usr/lib64/httpd/modules/mod_deflate.so
httpd     18797      root  mem       REG              253,1    10512    1841208 /usr/lib64/httpd/modules/mod_expires.so
httpd     18797      root  mem       REG              253,1    27672    1841220 /usr/lib64/httpd/modules/mod_mime_magic.so
httpd     18797      root  mem       REG              253,1    23120    1841209 /usr/lib64/httpd/modules/mod_ext_filter.so
httpd     18797      root  mem       REG              253,1    10416    1841207 /usr/lib64/httpd/modules/mod_env.so
httpd     18797      root  mem       REG              253,1    10440    1841218 /usr/lib64/httpd/modules/mod_logio.so
httpd     18797      root  mem       REG              253,1    27168    1841216 /usr/lib64/httpd/modules/mod_log_config.so
httpd     18797      root  mem       REG              253,1    43600    1841213 /usr/lib64/httpd/modules/mod_include.so
httpd     18797      root  mem       REG              253,1    31192    1841188 /usr/lib64/httpd/modules/mod_authnz_ldap.so
httpd     18797      root  mem       REG              253,1    43880    1310762 /lib64/librt-2.12.so
httpd     18797      root  mem       REG              253,1    88600    1310784 /lib64/libz.so.1.2.3
httpd     18797      root  mem       REG              253,1   244656    1310798 /lib64/libnspr4.so
httpd     18797      root  mem       REG              253,1    18720    1310799 /lib64/libplc4.so
httpd     18797      root  mem       REG              253,1    14560    1310800 /lib64/libplds4.so
httpd     18797      root  mem       REG              253,1   179416    1836210 /usr/lib64/libnssutil3.so
httpd     18797      root  mem       REG              253,1  1299984    1839492 /usr/lib64/libnss3.so
httpd     18797      root  mem       REG              253,1   181168    1839494 /usr/lib64/libsmime3.so
httpd     18797      root  mem       REG              253,1   254328    1839495 /usr/lib64/libssl3.so
httpd     18797      root  mem       REG              253,1   106160    1836285 /usr/lib64/libsasl2.so.2.0.23
httpd     18797      root  mem       REG              253,1   110960    1310760 /lib64/libresolv-2.12.so
httpd     18797      root  mem       REG              253,1    60512    1310943 /lib64/liblber-2.4.so.2.10.2
httpd     18797      root  mem       REG              253,1   326736    1310945 /lib64/libldap-2.4.so.2.10.2
httpd     18797      root  mem       REG              253,1    56144    1841215 /usr/lib64/httpd/modules/mod_ldap.so
httpd     18797      root  mem       REG              253,1     6264    1841190 /usr/lib64/httpd/modules/mod_authz_default.so
httpd     18797      root  mem       REG              253,1    10448    1841189 /usr/lib64/httpd/modules/mod_authz_dbm.so
httpd     18797      root  mem       REG              253,1    10520    1841191 /usr/lib64/httpd/modules/mod_authz_groupfile.so
httpd     18797      root  mem       REG              253,1    10424    1841193 /usr/lib64/httpd/modules/mod_authz_owner.so
httpd     18797      root  mem       REG              253,1    10384    1841194 /usr/lib64/httpd/modules/mod_authz_user.so
httpd     18797      root  mem       REG              253,1    10448    1841192 /usr/lib64/httpd/modules/mod_authz_host.so
httpd     18797      root  mem       REG              253,1     6264    1841186 /usr/lib64/httpd/modules/mod_authn_default.so
httpd     18797      root  mem       REG              253,1    10416    1841185 /usr/lib64/httpd/modules/mod_authn_dbm.so
httpd     18797      root  mem       REG              253,1    10352    1841183 /usr/lib64/httpd/modules/mod_authn_anon.so
httpd     18797      root  mem       REG              253,1    10456    1841182 /usr/lib64/httpd/modules/mod_authn_alias.so
httpd     18797      root  mem       REG              253,1    10416    1841187 /usr/lib64/httpd/modules/mod_authn_file.so
httpd     18797      root  mem       REG              253,1    31256    1841181 /usr/lib64/httpd/modules/mod_auth_digest.so
httpd     18797      root  mem       REG              253,1    10448    1841180 /usr/lib64/httpd/modules/mod_auth_basic.so
httpd     18797      root  mem       REG              253,1   477736    1310726 /lib64/libfreebl3.so
httpd     18797      root  mem       REG              253,1    16304    1310812 /lib64/libuuid.so.1.3.0
httpd     18797      root  mem       REG              253,1    19536    1310740 /lib64/libdl-2.12.so
httpd     18797      root  mem       REG              253,1  1921176    1310734 /lib64/libc-2.12.so
httpd     18797      root  mem       REG              253,1   142640    1310758 /lib64/libpthread-2.12.so
httpd     18797      root  mem       REG              253,1   181856    1836441 /usr/lib64/libapr-1.so.0.3.9
httpd     18797      root  mem       REG              253,1  1522808    1310793 /lib64/libdb-4.7.so
httpd     18797      root  mem       REG              253,1   165264    1310804 /lib64/libexpat.so.1.5.2
httpd     18797      root  mem       REG              253,1    40400    1310738 /lib64/libcrypt-2.12.so
httpd     18797      root  mem       REG              253,1   146080    1836443 /usr/lib64/libaprutil-1.so.0.3.9
httpd     18797      root  mem       REG              253,1   122040    1310810 /lib64/libselinux.so.1
httpd     18797      root  mem       REG              253,1   181432    1310818 /lib64/libpcre.so.0.0.1
httpd     18797      root  mem       REG              253,1   596272    1310742 /lib64/libm-2.12.so
httpd     18797      root  mem       REG              253,1   154528    1310727 /lib64/ld-2.12.so
httpd     18797      root  DEL       REG                0,4              687676 /dev/zero
httpd     18797      root  DEL       REG                0,4              687674 /dev/zero
httpd     18797      root  DEL       REG                0,4              687671 /dev/zero
httpd     18797      root    0r      CHR                1,3      0t0       3793 /dev/null
httpd     18797      root    1w      CHR                1,3      0t0       3793 /dev/null
httpd     18797      root    2w      REG              253,1     6758    5507099 /var/www/bbemod/logs/error_log
httpd     18797      root    3u     sock                0,6      0t0     687637 can't identify protocol
httpd     18797      root    4u     IPv6             687638      0t0        TCP *:http (LISTEN)
httpd     18797      root    5u     sock                0,6      0t0     687641 can't identify protocol
httpd     18797      root    6u     IPv6             687642      0t0        TCP *:https (LISTEN)
httpd     18797      root    7r     FIFO                0,8      0t0     687665 pipe
httpd     18797      root    8w     FIFO                0,8      0t0     687665 pipe
httpd     18797      root    9w      REG              253,1     3555    5507101 /var/www/bbemod/logs/ssl_error_log
httpd     18797      root   10w      REG              253,1    39551    5507223 /var/www/bbemod/logs/access_log
httpd     18797      root   11w      REG              253,1        0    5507224 /var/www/bbemod/logs/ssl_access_log
httpd     18797      root   12w      REG              253,1        0    5507225 /var/www/bbemod/logs/ssl_request_log
httpd     18797      root   13r      CHR                1,9      0t0       3798 /dev/urandom
httpd     18799    apache  cwd       DIR              253,1     4096          2 /
httpd     18799    apache  rtd       DIR              253,1     4096          2 /
httpd     18799    apache  txt       REG              253,1   355232    1841243 /usr/sbin/httpd
httpd     18799    apache  mem       REG              253,1    83088    2491345 /usr/lib64/php/modules/zip.so
httpd     18799    apache  mem       REG              253,1    44368    2491349 /usr/lib64/php/modules/sqlite3.so
httpd     18799    apache  mem       REG              253,1   261392    2491344 /usr/lib64/php/modules/phar.so
httpd     18799    apache  mem       REG              253,1   584080    1836282 /usr/lib64/libsqlite3.so.0.8.6
httpd     18799    apache  mem       REG              253,1    24640    2491348 /usr/lib64/php/modules/pdo_sqlite.so
httpd     18799    apache  mem       REG              253,1    30112    2491352 /usr/lib64/php/modules/pdo_mysql.so
httpd     18799    apache  mem       REG              253,1   102456    2491347 /usr/lib64/php/modules/pdo.so
httpd     18799    apache  mem       REG              253,1   136832    2491351 /usr/lib64/php/modules/mysqli.so
httpd     18799    apache  mem       REG              253,1  1584680    1839230 /usr/lib64/mysql/libmysqlclient.so.16.0.0
httpd     18799    apache  mem       REG              253,1    54408    2491350 /usr/lib64/php/modules/mysql.so
httpd     18799    apache  mem       REG              253,1    36200    2491343 /usr/lib64/php/modules/json.so
httpd     18799    apache  mem       REG              253,1  1843056    2491342 /usr/lib64/php/modules/fileinfo.so
httpd     18799    apache  mem       REG              253,1   161664    1839304 /usr/lib64/libssh2.so.1.0.1
httpd     18799    apache  mem       REG              253,1   206640    1310838 /lib64/libidn.so.11.6.1
httpd     18799    apache  mem       REG              253,1   343088    1839520 /usr/lib64/libcurl.so.4.1.1
httpd     18799    apache  mem       REG              253,1    66096    2491341 /usr/lib64/php/modules/curl.so
httpd     18799    apache  mem       REG              253,1     9488    2102979 /usr/lib64/apr-util-1/apr_ldap-1.so
httpd     18799    apache  mem       REG              253,1    27424    1310748 /lib64/libnss_dns-2.12.so
httpd     18799    apache  mem       REG              253,1    65928    1310750 /lib64/libnss_files-2.12.so
httpd     18799    apache  mem       REG              253,1    14584    1310766 /lib64/libutil-2.12.so
httpd     18799    apache  mem       REG              253,1  1669872    1840545 /usr/lib64/libpython2.6.so.1.0
httpd     18799    apache  mem       REG              253,1   152584    1842643 /usr/lib64/httpd/modules/mod_wsgi.so
httpd     18799    apache  mem       REG              253,1   181840    1842560 /usr/lib64/httpd/modules/mod_ssl.so
httpd     18799    apache  mem       REG              253,1    10192    1310821 /lib64/libkeyutils.so.1.3
httpd     18799    apache  mem       REG              253,1    43728    1310831 /lib64/libkrb5support.so.0.1
httpd     18799    apache  mem       REG              253,1  1963264    1839148 /usr/lib64/libcrypto.so.1.0.1e
httpd     18799    apache  mem       REG              253,1   441112    1839150 /usr/lib64/libssl.so.1.0.1e
httpd     18799    apache  mem       REG              253,1    14664    1310788 /lib64/libcom_err.so.2.1
httpd     18799    apache  mem       REG              253,1   174840    1310827 /lib64/libk5crypto.so.3.1
httpd     18799    apache  mem       REG              253,1   941920    1310829 /lib64/libkrb5.so.3.3
httpd     18799    apache  mem       REG              253,1   277704    1310823 /lib64/libgssapi_krb5.so.2.2
httpd     18799    apache  mem       REG              253,1  1381472    1836120 /usr/lib64/libxml2.so.2.7.6
httpd     18799    apache  mem       REG              253,1   113432    1310744 /lib64/libnsl-2.12.so
httpd     18799    apache  mem       REG              253,1    67592    1310792 /lib64/libbz2.so.1.0.4
httpd     18799    apache  mem       REG              253,1   374408    1836463 /usr/lib64/libgmp.so.3.5.0
httpd     18799    apache  mem       REG              253,1  3699056    1842243 /usr/lib64/httpd/modules/libphp5.so
httpd     18799    apache  mem       REG              253,1    10416    1841239 /usr/lib64/httpd/modules/mod_version.so
httpd     18799    apache  mem       REG              253,1    27312    1841198 /usr/lib64/httpd/modules/mod_cgi.so
httpd     18799    apache  mem       REG              253,1    22992    1841205 /usr/lib64/httpd/modules/mod_disk_cache.so
httpd     18799    apache  mem       REG              253,1    10384    1841235 /usr/lib64/httpd/modules/mod_suexec.so
httpd     18799    apache  mem       REG              253,1    39664    1841196 /usr/lib64/httpd/modules/mod_cache.so
httpd     18799    apache  mem       REG              253,1    14648    1841225 /usr/lib64/httpd/modules/mod_proxy_connect.so
httpd     18799    apache  mem       REG              253,1    39632    1841223 /usr/lib64/httpd/modules/mod_proxy_ajp.so
httpd     18799    apache  mem       REG              253,1    31472    1841227 /usr/lib64/httpd/modules/mod_proxy_http.so
httpd     18799    apache  mem       REG              253,1    35600    1841226 /usr/lib64/httpd/modules/mod_proxy_ftp.so
httpd     18799    apache  mem       REG              253,1    27160    1841224 /usr/lib64/httpd/modules/mod_proxy_balancer.so
httpd     18799    apache  mem       REG              253,1    85328    1841222 /usr/lib64/httpd/modules/mod_proxy.so
httpd     18799    apache  mem       REG              253,1    60464    1841230 /usr/lib64/httpd/modules/mod_rewrite.so
httpd     18799    apache  mem       REG              253,1    14608    1841234 /usr/lib64/httpd/modules/mod_substitute.so
httpd     18799    apache  mem       REG              253,1    14608    1841178 /usr/lib64/httpd/modules/mod_alias.so
httpd     18799    apache  mem       REG              253,1    10448    1841237 /usr/lib64/httpd/modules/mod_userdir.so
httpd     18799    apache  mem       REG              253,1    14608    1841232 /usr/lib64/httpd/modules/mod_speling.so
httpd     18799    apache  mem       REG              253,1    10416    1841177 /usr/lib64/httpd/modules/mod_actions.so
httpd     18799    apache  mem       REG              253,1    10416    1841204 /usr/lib64/httpd/modules/mod_dir.so
httpd     18799    apache  mem       REG              253,1    31384    1841221 /usr/lib64/httpd/modules/mod_negotiation.so
httpd     18799    apache  mem       REG              253,1    10424    1841240 /usr/lib64/httpd/modules/mod_vhost_alias.so
httpd     18799    apache  mem       REG              253,1    52016    1841201 /usr/lib64/httpd/modules/mod_dav_fs.so
httpd     18799    apache  mem       REG              253,1    19032    1841214 /usr/lib64/httpd/modules/mod_info.so
httpd     18799    apache  mem       REG              253,1    35472    1841195 /usr/lib64/httpd/modules/mod_autoindex.so
httpd     18799    apache  mem       REG              253,1    22864    1841233 /usr/lib64/httpd/modules/mod_status.so
httpd     18799    apache  mem       REG              253,1    93328    1841200 /usr/lib64/httpd/modules/mod_dav.so
httpd     18799    apache  mem       REG              253,1    18800    1841219 /usr/lib64/httpd/modules/mod_mime.so
httpd     18799    apache  mem       REG              253,1    14576    1841231 /usr/lib64/httpd/modules/mod_setenvif.so
httpd     18799    apache  mem       REG              253,1    14608    1841238 /usr/lib64/httpd/modules/mod_usertrack.so
httpd     18799    apache  mem       REG              253,1    18896    1841211 /usr/lib64/httpd/modules/mod_headers.so
httpd     18799    apache  mem       REG              253,1    27056    1841203 /usr/lib64/httpd/modules/mod_deflate.so
httpd     18799    apache  mem       REG              253,1    10512    1841208 /usr/lib64/httpd/modules/mod_expires.so
httpd     18799    apache  mem       REG              253,1    27672    1841220 /usr/lib64/httpd/modules/mod_mime_magic.so
httpd     18799    apache  mem       REG              253,1    23120    1841209 /usr/lib64/httpd/modules/mod_ext_filter.so
httpd     18799    apache  mem       REG              253,1    10416    1841207 /usr/lib64/httpd/modules/mod_env.so
httpd     18799    apache  mem       REG              253,1    10440    1841218 /usr/lib64/httpd/modules/mod_logio.so
httpd     18799    apache  mem       REG              253,1    27168    1841216 /usr/lib64/httpd/modules/mod_log_config.so
httpd     18799    apache  mem       REG              253,1    43600    1841213 /usr/lib64/httpd/modules/mod_include.so
httpd     18799    apache  mem       REG              253,1    31192    1841188 /usr/lib64/httpd/modules/mod_authnz_ldap.so
httpd     18799    apache  mem       REG              253,1    43880    1310762 /lib64/librt-2.12.so
httpd     18799    apache  mem       REG              253,1    88600    1310784 /lib64/libz.so.1.2.3
httpd     18799    apache  mem       REG              253,1   244656    1310798 /lib64/libnspr4.so
httpd     18799    apache  mem       REG              253,1    18720    1310799 /lib64/libplc4.so

Open in new window

0
arnoldCommented:
What do you have PHP site/s?

Possible did you alter the httpd mechanism?
when you can run service httpd stop
ps -ef | grep httpd
see if any returns
The issue might be that the location where the PID is stored /var/run/httpd for example is no longer correct.
i.e. the httpd.pid is there, but is invalid, the start mechanism places the PID in a different location.

apacheclt status
0
Jason YuAuthor Commented:
[root@point ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point ~]# service httpd stop
Stopping httpd:                                            [FAILED]
[root@point ~]# ps -ef | grep httpd
root     18865     1  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18867 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18868 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18869 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18870 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18871 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18872 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18873 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18874 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
root     18906 18736  0 12:23 pts/0    00:00:00 grep httpd
[root@point ~]#
0
Jason YuAuthor Commented:
I have to use fuser command to kill all processes running on port 80 to restart httpd service.

[root@point ~]# service httpd status
httpd is stopped
[root@point ~]# service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]
[root@point ~]# ps -ef | grep httpd
root     18865     1  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18867 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18868 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18869 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18870 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18871 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18872 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18873 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
apache   18874 18865  0 12:14 ?        00:00:00 /usr/sbin/httpd
root     18931 18736  0 12:24 pts/0    00:00:00 grep httpd
[root@point ~]# fuser -k -n tcp 80
80/tcp:              18865 18867 18868 18869 18870 18871 18872 18873 18874
[root@point ~]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point ~]#
0
Jan SpringerCommented:
check /var/run and/or /var/lock/subsys to see which process the system thinks owns this.
0
arnoldCommented:
look at /etc/init.d/httpd see when you hit stop where is it trying pidfile= the default is in /var/run/httpd/httpd.pid
see when this file was last modified.
The location of the file can be changed in httpd.conf

That might be the cause of your issue. service httpd trying to access a pid file that is not valid....
0
gheistCommented:
What do you have in httpd.conf ?
PidFile?
It should be in /var/run/httpd/httpd.pid for init script to work (bu default via symlink in /etc/httpd....

I also see that you use non-default location for logs, that asks for trouble as you dont get automatic log rotation.
0
Jason YuAuthor Commented:
the PidFile definition in httpd.pid is as following:


#
# PidFile: The file in which the server should record its process
# identification number when it starts.  Note the PIDFILE variable in
# /etc/sysconfig/httpd must be set appropriately if this location is
# changed.
#
PidFile run/httpd.pid
0
Jason YuAuthor Commented:
[root@point run]# locate httpd.pid
/var/run/httpd/httpd.pid
0
Jason YuAuthor Commented:
It's interesting, when i try to cat the httpd.pid file, it doesn't exist in the /var/run/httpd/  directory.



[root@point conf]# cat /var/run/httpd/httpd.pid
cat: /var/run/httpd/httpd.pid: No such file or directory
[root@point conf]# ls -alth /var/run/httpd/httpd.pid
ls: cannot access /var/run/httpd/httpd.pid: No such file or directory
[root@point conf]# pwd
/etc/httpd/conf
[root@point conf]#
0
Jason YuAuthor Commented:
Basically, this directory contains nothing.

[root@point conf]# cd /var/run/httpd
[root@point httpd]# ls -alth
total 8.0K
drwxr-xr-x. 22 root root   4.0K May  7 19:03 ..
drwx--x---.  2 root apache 4.0K Apr 28 16:15 .
[root@point httpd]# pwd
/var/run/httpd
[root@point httpd]#
0
Jason YuAuthor Commented:
where is my current httpd.pid file located? Is this the problem why I can't stop and start httpd service smothly?

thanks.
0
Jason YuAuthor Commented:
arnold, in my /etc/init.d/httpd file, it defines pidfile as below. I cannot understand what this line means, please explain, thanks.

pidfile=${PIDFILE-/var/run/httpd/httpd.pid}


# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
STOP_TIMEOUT=${STOP_TIMEOUT-10}
0
Jason YuAuthor Commented:
It's a dilemma, the "locate" command shows the httpd.pid file is under /var/run/httpd/httpd.pid but the file is actually not there.


[root@point httpd]# cat /var/run/httpd/httpd.pid
cat: /var/run/httpd/httpd.pid: No such file or directory
[root@point httpd]# locate httpd.pid
/var/run/httpd/httpd.pid
[root@point httpd]#
0
Jason YuAuthor Commented:
although I stopped the httpd service, the ps command still shows there are several httpd demons running.


[root@point subsys]# ps -ef | grep httpd
root      1839     1  0 May07 ?        00:00:05 /usr/sbin/httpd
apache    1841  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1842  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1843  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1844  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1845  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1846  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1847  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
apache    1848  1839  0 May07 ?        00:00:00 /usr/sbin/httpd
root      4591  1779  0 16:58 pts/0    00:00:00 grep httpd
[root@point subsys]# /etc/init.d/httpd status
httpd is stopped
[root@point subsys]#
0
Jan SpringerCommented:
Kill them all off and remove the pid file in /var/run/httpd.

Do a "service httpd start".

Then do a "service httpd status".

It sounds like the pid file is not where the init script expects it to be.
0
arnoldCommented:
There is no /var/run/httpd the httpd.conf file point to /var/run where one will find httpd.pid.


This notation is a patern replacement
pidfile=${PIDFILE-/var/run/httpd/httpd.pid}
If $PIDFILE is defined, use the value it has to assign to pidfile
if it is not defined, use /var/run/httpd/httpd.pid as the assigned value to pidfile.

this is where the issue might into play, httpd.conf or is it in /etc/sysconfig/httpd says store the httpd.pid file in /var/run/httpd.pid

Correct the entry in httpd.conf or in /etc/sysconfig/httpd to point to run/httpd/httpd.pid and you should be fine going forward (after one restart of the service.). apachectl stop
apachectl start.  /etc/init.d/httpd status should return running with the pid without the error.
0
gheistCommented:
Where is httpd.pid in httpd.conf ?
It must match one in init script to stop or reload httpd using script as opposed to apachectl which always uses httpd.conf.
0
Jan SpringerCommented:
I would expect your PID file to be in /var/run/http/.

Check that the directory path exists or change your PID location in both the startup script and the httpd.conf to /var/run
0
Jason YuAuthor Commented:
In my httpd.conf file I have the following lines:

#
# PidFile: The file in which the server should record its process
# identification number when it starts.  Note the PIDFILE variable in
# /etc/sysconfig/httpd must be set appropriately if this location is
# changed.
#
PidFile run/httpd.pid
0
arnoldCommented:
Change it to run/httpd/httpd.pid and see if it makes a difference.
0
Jason YuAuthor Commented:
Jan:

I checked the directory as you suggested.
0
Jason YuAuthor Commented:
[root@point httpd]# ls -alth
total 8.0K
drwxr-xr-x. 22 root root   4.0K May  7 19:03 ..
drwx--x---.  2 root apache 4.0K Apr 28 16:15 .
[root@point httpd]#
0
Jason YuAuthor Commented:
it doesn't have any file inside this folder:

[root@point ~]# cd /var/run/httpd
[root@point httpd]# ls -alth
total 8.0K
drwxr-xr-x. 22 root root   4.0K May  7 19:03 ..
drwx--x---.  2 root apache 4.0K Apr 28 16:15 .
[root@point httpd]# pwd
/var/run/httpd
[root@point httpd]#
0
arnoldCommented:
Start the HTTPd using service httpd start and check the directory again to see whether httpd.pid is present.
0
Jason YuAuthor Commented:
after I changed the pidfile location in httpd.conf file, it's not working.

[root@point subsys]# service httpd status
httpd dead but subsys locked
[root@point subsys]# service httpd stop
Stopping httpd:                                            [FAILED]
[root@point subsys]# service httpd start
Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]
[root@point subsys]#
0
Jason YuAuthor Commented:
it's interesting, after I made that change, it can start the service without error anymore.


but when I stop the service, it still shows the error.


[root@point subsys]# fuser -k -n tcp 80
80/tcp:               4635  4637  4638  4639  4640  4641  4642  4643  4644
[root@point subsys]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point subsys]# service httpd stop
Stopping httpd:                                            [FAILED]
[root@point subsys]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point subsys]# service httpd stop
Stopping httpd:                                            [FAILED]
[root@point subsys]# service httpd status
httpd is stopped
[root@point subsys]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point subsys]#

Open in new window

0
arnoldCommented:
In prior comments we outlined where the PID is being loaded from
/etc/sysconfig/httpd
/etc/httpd/conf/httpd.conf
When you start httpd, is there a file in /var/run/httpd/httpd.pid

Is the PId there reflects the same PId as shown as the top Pid for ps -ef |grep httpd

S
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason YuAuthor Commented:
I restarted the service again by using "service httpd start", then checking the /var/run/httpd directory, there is no pid


[root@point httpd]# pwd
/var/run/httpd
[root@point httpd]# ls -alth
total 8.0K
drwxr-xr-x. 22 root root   4.0K May  7 19:03 ..
drwxr-xr-x.  2 root apache 4.0K Apr 28 16:15 .
[root@point httpd]#
0
Jason YuAuthor Commented:
where is the "startup script", is it in rc.d directory?
0
Jason YuAuthor Commented:
in the file "/etc/sysconfig/httpd", the pidfile line is commented out, do I need enable it?

Please advise, thank you.


#
# By default, the httpd process will create the file
# /var/run/httpd/httpd.pid in which it records its process
# identification number when it starts.  If an alternate location is
# specified in httpd.conf (via the PidFile directive), the new
# location needs to be reported in the PIDFILE.
#
#PIDFILE=/var/run/httpd/httpd.pid
0
Jason YuAuthor Commented:
Finally, it's working now. I updated both files and enabled the pidfile line in the /etc/sysconfig/httpd directory.

Now it works as a champion!


[root@point subsys]# vi /etc/sysconfig/httpd
[root@point subsys]# vi /etc/httpd/conf/httpd.conf
[root@point subsys]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point subsys]# service httpd status
httpd (pid  14276) is running...
[root@point subsys]# service httpd stop
Stopping httpd:                                            [  OK  ]
[root@point subsys]# service httpd status
httpd is stopped
[root@point subsys]# service httpd start
Starting httpd:                                            [  OK  ]
[root@point subsys]# service httpd status
httpd (pid  14331) is running...
[root@point subsys]#
0
Jason YuAuthor Commented:
I also see the httpd.pid file was created under /var/run/httpd   folder.



[root@point httpd]# ls -alth
total 12K
drwxr-xr-x.  2 root apache 4.0K May 12 16:45 .
-rw-r--r--.  1 root root      6 May 12 16:45 httpd.pid
drwxr-xr-x. 22 root root   4.0K May  7 19:03 ..
[root@point httpd]# cat httpd.pid
14331
[root@point httpd]# pwd
/var/run/httpd
[root@point httpd]#
0
Jason YuAuthor Commented:
wonderful answer, I got it.

[root@point httpd]# ps -ef |grep httpd
root     14331     1  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14333 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14334 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14335 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14336 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14337 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14338 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14339 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
apache   14340 14331  0 16:45 ?        00:00:00 /usr/sbin/httpd
root     14368 14000  0 16:49 pts/1    00:00:00 grep httpd
[root@point httpd]# cat httpd.pid
14331
[root@point httpd]#
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.