Occasionally, for some reason or another – usually because you changed some setting – it is necessary to restart apache from the terminal (i.e. in PuTTy).
Sometimes, though this is rare, this fails. If apache fails to restart and displays a message similar to “Address already in use: make_sock: could not bind to address” then you may be wondering how to get your server back online!
The precise message you receive could look something like this:
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
You may or may not have other error messages, but let’s deal with this one!
The slow fix is to do a full hardware reboot of your server. This takes quite some time, and is not necessarily the best course of action, but it should solve this issue.
The reason for the message, however, is that there are still active connections which were not closed before. Probably some process was running when you hit “restart” (you should identify just what by checking – but that’s beyond the scope of what we’re doing here!). In any case, you’ll want to find out what process is running, and “kill” it.
1) Type “
ps -aux |grep httpd
2) This will return a set of processes which are currently running. There should not be more than one or two. It will look something like this:
root 23605 0.1 0.1 861052 21208 ? Ss 10:07 0:00 /usr/sbin/httpd
apache 23609 0.0 0.0 220500 7720 ? S 10:07 0:00 /usr/sbin/httpd
root 23697 0.0 0.0 61184 776 pts/0 S+ 10:10 0:00 grep httpd
3) Kill the apache processes which are showing by typing:
kill -9 23609
Remember to replace “23609″ with whatever number your process actually is!
An alternative to this, if you have a lot of processes all running, is to use the “killall” method, which is:
1 killall -9 httpd
Then restart apache – it should work correctly!
You’ll then want to set about identifying which processes were causing this in the first place!
Leave a comment below if this worked for you – or if it didn’t – and we might be able to help.
- Tuning WordPress for Faster PageSpeed: Use Httpd.conf Instead of .htaccess for Permalinks
- Installing XCache on Amazon EC2
- Installing the GD Library
- How to Get Auto-Update Working on WordPress – Update WP Version & Plugins Without FTP
- How to Make WordPress Auto-Thumbnails Work