Linux – Centos 5, can’t restart apache server

centoslinux

I am using Centos 5 to run linux server.

I restart the Apache server with this command

service httpd restart

Usually, it works fine. It didn't work at this time and showed me this error.

yum install php-devel 

I believe I used 'yum' to install php-devel

httpd (À»)¸¦ ½ÃÀÛ Áß: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(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

I used to have ServerName in httpd.conf file.

I searched google to find the answer and most people said that put 'ServerName localhost'

I did it and got same error message.

The server is running now, but can't restart Apache server.

Best Answer

The localhost fix should have ideally solved the problem. Just make sure that where you added the localhost in front of ServerName, that line is not commented.

Also make sure there are no duplicate files of the httpd.conf file. I had the same problem once and when I googled, I found that -

/etc/httpd/conf/httpd.conf and /etc/httpd/conf.d/system-config-httpd.conf

deleting the second one, fixed the issue for me.

If that is not the case, I hope you have already tried this -

instead of direct restart, do

/sbin/service httpd stop
/sbin/service httpd start

If that doesn't work, try

apachectl restart

or

apache2ctl restart

This ideally shouldn't make a difference, it executes the same command, but worth a try.

Related Question