Turning on Web Sharing does not work and fails to load apache web server
Sort of answering my own question here but hope it will be useful to other people and save them some time.
After receiving my shiny new imac with os x lion pre-installed, I was a little dismayed and confused when I went to System Preferences -> Internet and Wireless -> Sharing and attempted to check the Web Sharing. Every time I clicked this option I was told Web Sharing was starting but would then repeatedly fail and apache failed to start.
Looking in the Console I find:
org.apache.httpd: dyld: Library not loaded: /usr/lib/libpq.5.dylib
org.apache.httpd: Referenced from: /usr/sbin/httpd
org.apache.httpd: Reason: image not found
Entering in the console:
vim /Library/Logs/DiagnosticReports/httpd_2011-08-06-165030_localhost.crash (date and time bit will vary)
reveals:
Process: httpd [2418]
Path: /usr/sbin/httpd
Identifier: httpd
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
Date/Time: 2011-08-06 16:50:30.106 +0100
OS Version: Mac OS X 10.7 (11A511a)
Report Version: 9
Crashed Thread: 0
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Application Specific Information:
dyld: launch, loading dependent libraries
Dyld Error Message:
Library not loaded: /usr/lib/libpq.5.dylib
Referenced from: /usr/sbin/httpd
Reason: image not found
Binary Images:
0x1022f6000 - 0x102352fef httpd (??? - ???) <9D63FBFD-DD87-3DD5-AD1A-D8A79FEC3EE8> /usr/sbin/httpd
@
"/Library/Logs/DiagnosticReports/httpd_2011-08-06-165030_localhost.crash" 32L, 1469C
TO FIX THIS ISSUE:
It appears /usr/lib/libpq.5.dylib does not exist but /usr/lib/libpq.5.3.dylib does.
Fix by creating a symbolic link from /usr/lib/libpq.5.3.dylib to /usr/lib/libpq.5.dylib
=
sudo ln -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib
Going back to System Preferences -> Internet and Wireless -> Sharing clicking Web Sharing a couple of times turns Web Sharing on successfully!
Going to http://localhost/ displays the "It Works!" page.
HTH people as it took me a while to find the correct solution online from:
http://www.azattis.com/2011/07/os-x-lion-postgresql-84-install-problem.html
MacBook Air, Mac OS X (10.7)