Archives pour la catégorie Développement

Homebrew : Apache says it’s started but localhost does not load


I have to admit I didn’t upgrade or even update homebrew for month as I was travelling. Yes, this is quite important for me while I’m travelling. I don’t update anything because I want my system to stay stable to not spend my time fixing any problems on the road. I came back home a few days ago so, I decided to update at least, MacOSX.

Today I went through a very annoying experience. I switched on my laptop to work and then the mess happened. Apache said it’s started but localhost didn’t wanna load…

Fixing process

I know Apache is a Homebrew packet and I know I just updated my OS. Here is the process I had to fix the problem.

$ brew update
$ brew upgrade

Yes I don’t like to chain my commands but if you do,  feel free to use brew update && upgrade.

Unfortunately the upgrade sent me many errors. It would be useless to show them here so just keep reading :)

$ brew doctor

It said update xcode, xquarkz and install mhash

  • Visit this link to update XCode
  • Visit this link to update XQuarkz

You’ll probably have to update or install the command line with XCode.

$ xcode-select --install
$ brew install mhash
$ brew update
$ brew upgrade

Finally get something interesting!

Error: No available formula for bison27
Searching taps...

It can be fixed in a second by a simple

$ brew tap homebrew/versions
$ brew upgrade

Apache still says it’s started but localhost does not load!

$ httpd -v

Server version: Apache/2.2.26 (Unix)
 Server built: Dec 10 2013 22:09:38
$ http -t

httpd: Syntax error on line 122 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/opt/php53/libexec/apache2/ into server: dlopen(/usr/local/opt/php53/libexec/apache2/, 10): Library not loaded: /usr/local/lib/libpng15.15.dylib\n Referenced from: /usr/local/opt/php53/libexec/apache2/\n Reason: image not found
$ php -v
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Trace/BPT trap: 5

Ok so now I know everything’s because of PHP and this library. At he begining I thought about a bad upgrade or something missing. So :

brew reinstall php55

But I had the same error with a second php -v

Ok so :

$ locate libpng15.15.dylib

$ ln -s /usr/local/Cellar/libpng/1.5.14/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib

Wouhou! It works! ;)
Just a last brew update && upgrade to be sure and then go back to work.