Httpd – Address already in use – Amazon AWS

amazon ec2amazon-web-servicesapache-2.2httpd

I've run into a really weird issue. I was debugging a server 500 error script on our EC2 instance and found that we didn't have ioncube loaders installed. So I went to go install them and I created a new file at /etc/php.d/zend.ini and initially I inserted the value of extension=/usr/local/ioncube/ioncube_loader_lin_5.3.so and restarted httpd at which point it told me:

The ionCube Loader is a Zend-Engine extension and not a module
Please specify the Loader using 'zend_extension' in php.ini
PHP Fatal error:  Unable to start ionCube Loader module in Unknown on line 0

So I changed the contents of zend.ini to zend_extension=/usr/…etc. Now when I attempt to restart httpd I get this error:

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

I can't even run /etc/init.d/httpd stop without it erroring. I've since removed zend.ini to see if that's what caused it and it doesn't seem to be.

Any ideas?

Best Answer

If there isn't anything listening on port 80 as per the suggestion from David Schwartz, the problem is most likely that you have two Listen 80 directives in your Apache config. They may not be near each other or even in the same file.

Try grep -r Listen /etc/httpd to find them and remove one of them.