0

I have a server, CentOs 6.5 which were installed xampp by a friend of mine. But I thought it's best to install apache, php and mysql from yum. I have it removed simply by using this

#rm -rf /opt/lampp

And I thought it has been completely removed but it didn't happen that way. Maybe I forgot to stop the service httpd. Then I proceed to install Apache 2.4 by following this steps. The error came out when I try to start

service httpd24-httpd start

Starting httpd: (98)Address already in use: AH00072: make_sock: could not bind to address 202.190.185.62:80
no listening sockets available, shutting down
AH00015: Unable to open logs

how do I fix this? Do I have to reinstall the apache by sudo yum install httpd

Muhaimin
  • 101
  • 1
  • 1
  • 4

6 Answers6

1

To find the process and kill it do the following

netstat -lnp | grep 80 will produce an output something like this.

unix  2      [ ACC ]     STREAM     LISTENING     80   1804/somesoftware     /somepath/and/filename

The 80 is the port number and the 1804 in this case is the process id.

kill -9 1804

Will terminate the process that is taking port 80. The problem is, that when you restart your machine, there is a good chance the software will start over again and you'll have to repeat the process.

Looking at your description of the problem. Try the following first.

service httpd24-httpd stop

You may already be running the apache server from the yum install.

R Schultz
  • 462
  • 4
  • 12
1

This happened to me when I had a VirtualHost configuration file under custom directory /etc/httpd/sites-enabled that had on top Listen 80

Happens that as it was already listening to this port on httpd.conf, it conflicted, resulting in that error. Removing multiple entries on Listen 80 and having only one at httpd.conf solves it. As I create VirtualHosts listening to ports instead of domains, I always include in the top of the VirtualHost .conf file Listen 12345 the number there corresponding to the adequate port.

0

type netstat -lnp | grep 80 and run, you will find which process listen on 80 port, then stop it and start httpd again.

PersianGulf
  • 10,728
  • 8
  • 51
  • 78
hiworld
  • 11
0

Except the solution find process running on :80 and kill, then start again,

This error might have if you have multiple "Listen" entries in apache conf file or in any .conf files Included in apache conf file.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
LPince
  • 111
  • 3
0

Quick Workaround

Kill the current instance of the webserver. You may want to change port 80, to 443 if you are using that port instead. After this you should be able to start your instance.

kill -SIGWINCH $(fuser 80/tcp 2>/dev/null | sort -n | awk {'print $1'})

SIGWINCH makes Apache serve any pending requests before shutting down gracefully. For a more forceful shutdown you can change to SIGKILL.

Solution

Identify where you redundant install comes from and remove it, so you can install and rely on your distributions stock package for your webserver.

# fuser 80/tcp 2>/dev/null | grep [0-9] | xargs ps u
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME 
COMMAND
root      5336  0.0  2.7 421492 27928 ?        Ss   May29   2:47 
/usr/sbin/apache2 -k start
www-data 14390  0.0  0.8 421948  8484 ?        S    16:59   0:00 
/usr/sbin/apache2 -k start
www-data 14395  0.0  0.8 421948  8396 ?        S    16:59   0:00 
/usr/sbin/apache2 -k start
www-data 14396  0.0  0.8 421964  8432 ?        S    16:59   0:00 
...

If you find a path that is in /opt, /usr/local, /opt or similar it is a strong indication that you have a local, manual installation in redundant to the distributions webserver package. Remove it and any start-up scripts that comes with it!

William Sandin
  • 381
  • 3
  • 7
-1

Step 1 : netstat -lnp | grep 80

tcp 0 0 :::80 :::* LISTEN 4032/httpd

Step 2 : kill -9 4032

Step 3: Service start httpd

The above simple 3 steps will resolve your issue.