Reputation: 81
I'm running into an issue with Apache 2.4.18 (on OS X El Capitan 10.11.6), and I cannot pinpoint what the cause is. I've spent 4 days trying to resolve this (including searching here), but I'm throwing in the towel and just asking.
I have little experience here. Following a few guides last weekend, I attempted to set up my system to allow me to develop a site as I work on learning HTML/Javascript/PHP. Following a few guides, I installed dnsmasq and attempted to configure httpd.conf and httpd-vhosts.conf. Initially, localhost directed me to the "It Works" page, as did my virtual hosts home.dev and sites.dev. No matter what I did, I couldn't get any *.dev site to direct to my actual index.html file in my virtualdocumentroot.
I've tried
home.dev
to /etc/hosts
httpd.conf
to root used in virtual hosts filehttpd-vhosts.conf
configurations.apachectl configtest
- Syntax is okNow the issue has gotten worse. In working with config files trying to fix this, I've broken something, and I have no idea what. Accidentally overwrote the httpd.conf
file in originals folder. Attempted to use httpd.conf
file I found searching for the default, does not work. At this point, I'd be happy just to see 'It Works' again...
sudo netstat -an | grep ':80'
returns nothing, so from the little I understand, it appears apache is not listening on 80, even though there's an explicit statement listen 80
in httpd.conf
.apachectl configtest
- Syntax still oksudo apachectl restart
- appears to startNot sure if I should post my .conf here, any suggestions?
Thanks!
Update 8/20:
Still haven't found a solution, but feel like I'm making progress:
ping localhost
is successful (64 bytes from 127.0.0.1)curl -v http://localhost/
returns 'connection refused' on all attempts (::1, fe80::1, 127.0.0.1, etc).Somewhere, it appears apache is running (right??), I just don't understand where or how to figure it out.
sudo lsof -i -P | grep -i "listen"
does not return anything listening on *:80. Also don't see any processes that sound like apache (only launchd, dnsmasq, mysqld, kdc, and Skype).
my hosts file is set as such:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
httpd.conf (previously Listen 80, this change didn't fix anything)
Listen 0.0.0.0:80
No errors in error log since 2 days ago when I accidentally deleted ServerName out of httpd.conf (added it back):)
Is there a netstat/lsof command I can enter and figure out what port apache is listening on? Maybe that will get me started in the right direction here.
Upvotes: 3
Views: 7247
Reputation: 81
Update:
For anyone else who encounters this, hopefully I can save you the week I spent trying to fix this.
Checked Console to find "ReportCrashes" for httpd (even though sudo apachectl start
appeared to work,and when running the command again I would get a service already loaded
message.) Searching for crumbs I came across https://discussions.apple.com/thread/6602475?tstart=0.
As simple as it sounds, commenting out the load PHP module in httpd.conf LoadModule php5_module libexec/apache2/libphp5.so
fixed everything. I can now access localhost. In the confusion I created for myself making changes, I assumed it was in the .conf file, but didn't have the original to revert to or see the issue. Obvious advice - make a backup before you change .conf files.
Now, of course, I can't use PHP, so if anyone has any tips there, that would be awesome. Libphp5.so exists in /libexec/apache2, but I also found Libphp7.so in /usr/local/php5/ (version issue??)
Upvotes: 5