You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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)

Posted on Aug 6, 2011 9:16 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 19, 2011 9:26 PM

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

5 replies

Jan 5, 2012 12:34 AM in response to chewynougat

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: http://192.168.1.4/~stewartfergusson/


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.



Password:

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

Password:

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

Password:

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

Password:

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)


To:


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


sfergusson1

'JollyoldEngland'

May 4, 2012 9:04 AM in response to chewynougat

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

Turning on Web Sharing does not work and fails to load apache web server

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.