I was using web-sharing and accessing some webpages that I had developed using localhost. I messed up a PostGreSQL installation and deleted anything related to PostGreSQL and in the process appear to have damaged my apache installation.

If I run ping localhost the result is

--- localhost ping statistics --- 794 packets transmitted, 794 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.033/0.076/0.920/0.055 ms

I then tried running apachectl configtest and recieved the following output:

Library not loaded: /usr/lib/libpq.5.dylib   Referenced from: /usr/sbin/httpd
Reason: image not found /usr/sbin/apachectl: line 90: 16227 Trace/BPT trap: 5       $HTTPD -t

I also tried

curl http://localhost || echo $? curl: (7) couldn't connect to host 7

Within System Preferences->Sharing->Web Sharing when I try to tick web-sharing I end up with it being unticked automatically. I'm fairly sure that my local webserver is not working, but I'm not sure what I can do to fix this problem.

  • I've also tried the instructions in this thread: discussions.apple.com/thread/3243357?start=0&tstart=0 – celenius Oct 12 '12 at 2:21
  • What does ls -l /usr/lib/libpq.5.dylib show? – nohillside Oct 13 '12 at 18:10
  • It shows lrwxr-xr-x 1 root wheel 41 Aug 22 09:14 /usr/lib/libpq.5.dylib -> /Library/PostgreSQL/9.1/lib/libpq.5.dylib – celenius Oct 13 '12 at 18:25
  • Aha, broken symlink. Try ls -l /usr/lib/libpq.* next. – nohillside Oct 13 '12 at 18:30
  • -rwxr-xr-x 1 root wheel 291680 Feb 20 2012 /usr/lib/libpq.5.3.dylib lrwxr-xr-x 1 root wheel 41 Aug 22 09:14 /usr/lib/libpq.5.dylib -> /Library/PostgreSQL/9.1/lib/libpq.5.dylib -rw-r--r-- 1 root wheel 1602000 Sep 8 2011 /usr/lib/libpq.a lrwxr-xr-x 1 root wheel 15 Feb 20 2012 /usr/lib/libpq.dylib -> libpq.5.3.dylib – celenius Oct 13 '12 at 18:32

Judging from your feedback in the comments, the installation of PostgreSQL brought its own version of libpq (which then got removed during un-install). To fix

cd /usr/lib
sudo rm libpq.5.dylib
sudo ln -s libpq.5.3.dylib libpq.5.dylib

Then run apachectl configtest again to check for further errors.

| improve this answer | |
  • Thanks for the suggestions. I ran the above code, and the output from apachectl configtest is the following: httpd: Could not reliably determine the server's fully qualified domain name, using celenius.local for ServerName Syntax OK – celenius Oct 13 '12 at 20:14
  • Disable/enable Web Sharing again then and point your browser to localhost – nohillside Oct 14 '12 at 5:59

You must log in to answer this question.

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