I maintain a local web development environment on my Mac via Homebrew, set up in roughly the way described here:


Everything was working fine, but now whenever I try to load a page from my local server I get an "ERR_CONNECTION_REFUSED" error. The other day I upgraded everything that Homebrew was managing, and I think the problem started after that: but I can't be sure.

How can I go about fixing this?

2 Answers 2


Okay, I ended up running

$ sudo apachectl configtest

which returned

httpd: Syntax error on line 488 of /usr/local/etc/apache2/2.2/httpd.conf: Cannot load /usr/local/Cellar/php56/5.6.14/libexec/apache2/libphp5.so into server: dlopen(/usr/local/Cellar/php56/5.6.14/libexec/apache2/libphp5.so, 10): image not found

When I edited httpd.conf, it turned out that it was trying to load two different version of libphp5.so: a new version that had been freshly installed (I think) by Homebrew, and an old version that Homebrew had (I think) deleted once it installed the new version.

For some reason, when Apache tried to load the old version of libphp5.so and found it wasn't there, this prevented Apache running at all. As soon as I deleted the line that tried to load the missing libphp5.so and restarted Apache everything worked fine.


Easier for me, listening on 8080 not 80 curl -I -L localhost helped me with the right info: Failed to connect to localhost port 80: Connection refused

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .