5 Replies Latest reply: May 4, 2012 9:04 AM by j Robson
chewynougat Level 1 (0 points)

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)




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




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:



MacBook Air, Mac OS X (10.7)
  • Jiri Krecek Level 4 (1,070 points)

    God almighty! It works!!!!!

    I had the same darn error and couldn't find anything on it, until I saw your post!

    Please go back to this entry and mark it as answered, so people can see that your solution works!!!!

  • <<Ian>> Level 1 (0 points)

    Yes, worked for me too. This problem devloped several days ago after a failed attempt to update iLife apps from the app store. I was trying to track down the referer to libpq.5.dylib and edit it to libpq.5.3.dylib, but your simlink is a simpler solution for now. Thanks

  • sfergusson1 Level 1 (0 points)

    Hi there,


    You seemed to have had a similar problem to what I now have and so wondered if you might be able to help me :-)


    I have posted this as a new post as well but if anyone has five mins could they take a look - I would be very grateful. Here you go:


    I am new to all this so I have probably made some simple errors and I hope someone can help me. I will retell what I have done as I haven't a clue what part of what I have done has mucked things up.


    I am really stuck. Web sharing will not start on my iMac running Lion OS X. It did work fine and then I wanted to activate PHP so my test website contact form would work (and send the data on the form throught to my email address.


    Before I did anything I turned on websharing and could view my website from another computer using:


    I think followed the instructions on this link to activate PHP -http://foundationphp.com/tutorials/php_leopard.php


    I then did a few things in terminal and will paste below what I did:


    Last login: Sun Jan  1 09:01:52 on console

    Stewart-Fergussons-iMac:~ stewartfergusson$ cd/private/etc

    -bash: cd/private/etc: No such file or directory

    Stewart-Fergussons-iMac:~ stewartfergusson$ cd

    Stewart-Fergussons-iMac:~ stewartfergusson$ cd prvate

    -bash: cd: prvate: No such file or directory

    Stewart-Fergussons-iMac:~ stewartfergusson$ cd private

    -bash: cd: private: No such file or directory

    Stewart-Fergussons-iMac:~ stewartfergusson$ cd /private/etc

    Stewart-Fergussons-iMac:etc stewartfergusson$ sudo cp php.ini.default php.ini



    WARNING: Improper use of the sudo command could lead to data loss

    or the deletion of important system files. Please double-check your

    typing when using sudo. Type "man sudo" for more information.



    To proceed, enter your password, or type Ctrl-C to abort.




    Stewart-Fergussons-iMac:etc stewartfergusson$

    Last login: Wed Jan  4 09:03:03 on console

    Stewart-Fergussons-iMac:etc stewartfergusson$

    Last login: Thu Jan  5 06:19:15 on console

    Stewart-Fergussons-iMac:etc stewartfergusson$ sudo In -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib


    sudo: In: command not found

    Stewart-Fergussons-iMac:etc stewartfergusson$ sudo ln -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib

    ln: /usr/lib/libpq.5.dylib: File exists

    Stewart-Fergussons-iMac:etc stewartfergusson$ sudo apachectl -t


    Syntax error on line 1 of /private/etc/apache2/httpd.conf:

    Invalid command '1', perhaps misspelled or defined by a module not included in the server configuration

    Stewart-Fergussons-iMac:etc stewartfergusson$ sudo apachectl configtest


    Syntax error on line 1 of /private/etc/apache2/httpd.conf:

    Invalid command '1', perhaps misspelled or defined by a module not included in the server configuration

    Stewart-Fergussons-iMac:etc stewartfergusson$




    An important point to note is that I now appear to have more than one http.config file and they are located in the following locations:


    1) Macintosh HD/etc/apache2/httpd.conf.default

    2) Macintosh HD/etc/apache2/httpd.conf.default.default

    3) Macintosh HD/etc/apache2/original/httpd.conf


    I edited this file (which one I have not got a clue) and also the php.ini file within Macintosh HD/etc/ using Terminal - the command I used was sudo cp php.ini.default php.ini


    This php.ini file now exists in two locations now as well:

    1) Macintosh HD/etc/php.ini

    2) Macintosh HD/etc/php.ini.default


    I then edited this file by changing the line of code below from:


    514 error_reporting = E_ALL & ~E_NOTICE (I think it said E_DEPRECATED actually) but I am lifting this from the web page in the link above)




    514 error_reporting = E_ALL


    I then saved this file.


    I then deactivated web sharing in System Preferences and since then have not been able to restart Web Sharing. I click it and it flashes orange for a second then does not start.



    This was all done to activate PHP on my iMac so I can host my own site which has a PHP contact form page.


    Please help I am so out of my depth I am very worried I may have changed things and I am going to forget what I did.


    If you need to know anything then please ask.


    Thank you so much




  • omo Level 1 (0 points)

    Thannks a lot; building up this symlink helped my to get my Mac OS X Lion Server (10.7.3) Profile Manager and Wiki services to finaly run.

  • j Robson Level 1 (115 points)

    hello @chewynougat


    i created the link per your suggestion...sudo ln -s /usr/lib/libpq.5.3.dylib /usr/lib/libpq.5.dylib


    i do see the link created..

    bash-3.2# ls -alt libpq*.*

    lrwxr-xr-x  1 root  wheel  24 May  4 08:58 libpq.5.dylib -> /usr/lib/libpq.5.3.dylib

    -rwxr-xr-x  1 root  wheel   0 May  4 08:57 libpq.5.3.dylib


    however, when i click on web sharing, i am still unable to start it.  do you have any idea?  please reply to my email, if possible, monkeycsk@gmail.com