"ERR_CONNECTION_REFUSED" on localhost after (I think) upgrading Apache via homebrew I maintain a local web development environment on my Mac via Homebrew, set up in roughly the way described here:

https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew

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?
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.