views:

1354

answers:

9

I have enabled the Web Server on my Mac OS X (10.5.6) by going to the System Preferences -> Internet & Network -> Sharing and clicking on the Web Server option. It gives me the IP address of my system as the Web Server, but even after clicking on it, it does not show the page, but gives an error: Failed to Connect

Any help on this would be wonderful.

I have tried with MAMP, but there, I am unable to get my own PHP pages to be displayed.

Starting and/or stopping the web server from the command line, gives me the following:

dyld: Symbol not found: _apr_socket_sendfile
  Referenced from: /usr/sbin/httpd
  Expected in: /usr/lib/libapr-1.0.dylib

Trace/BPT trap

The files on my box are:

~ $ ls -lrt /usr/lib/libapr*
-rwxr-xr-x  1 root  wheel  578640 Sep 23  2007 /usr/lib/libapr-1.0.2.7.dylib
-rwxr-xr-x  1 root  wheel  393696 Sep 23  2007 /usr/lib/libaprutil-1.0.2.7.dylib
-rwxrwxr-x  1 root  admin  569544 Oct 27 10:44 /usr/lib/libaprutil-1.0.2.12.dylib
-rwxrwxr-x  1 root  admin  835824 Oct 27 10:44 /usr/lib/libapr-1.0.2.12.dylib
lrwxr-xr-x  1 root  admin      25 Jan  4 22:28 /usr/lib/libaprutil-1.dylib -> libaprutil-1.0.2.12.dylib
lrwxr-xr-x  1 root  admin      25 Jan  4 22:28 /usr/lib/libaprutil-1.0.dylib -> libaprutil-1.0.2.12.dylib
lrwxr-xr-x  1 root  admin      21 Jan  4 22:28 /usr/lib/libapr-1.dylib -> libapr-1.0.2.12.dylib
lrwxr-xr-x  1 root  admin      21 Jan  4 22:28 /usr/lib/libapr-1.0.dylib -> libapr-1.0.2.12.dylib

The MD5 values are:

~ $ openssl md5 /usr/sbin/httpd /usr/lib/libapr-1.0.dylib 
MD5(/usr/sbin/httpd)= d5194790e9cfaca881d0e8fc3db24889
MD5(/usr/lib/libapr-1.0.dylib)= f7f7fd3cd315ca4e7c6ad2a2f222998e

The libapr-1.0.dylib is linked to the newer 1.0.2.12 version.

+1  A: 

If you're trying to access the pages from the computer itself just use http://localhost/. Also, try typing the IP address into the browser (instead of just clicking the link in the interface); don't ask me to explain why, but I've seen that make a difference.

Also make sure the OS's firewall is set to allow connections to Apache. "Personal Web Sharing" should be checked.

acrosman
not working... i have even tried restarting the system and reinstalling the browser.
gagneet
make sure the firewall is allowing connections
acrosman
+1  A: 

Maybe there are errors in the apache configuration.

If you disable the webserver in the System preferences and open a terminal you can check your configuration by typing:

httpd -t

If it gives a "Syntax OK" you're one step closer to a working webserver. Start the webserver manually by typing:

sudo httpd

If there are no errors, the webserver is started. Open a browser and check http://localhost. Sometimes an extra refresh (Command+R) is needed.

Stopping the server:

sudo httpd -k stop

If the manually starting works, but the System preferences version doesn't, Check the /var/log/apache2/error_log for errors.

Bob Fanger
Starting and/or stopping the server, gives the following:dyld: Symbol not found: _apr_socket_sendfile Referenced from: /usr/sbin/httpd Expected in: /usr/lib/libapr-1.0.dylibTrace/BPT trap
gagneet
+1  A: 

http://foundationphp.com/tutorials/php_leopard.php

I followed this on mine and it work perfectly.

Try to follow it a see if it works

fmsf
yes tried it, but i get the error, as i have appended in my question above.
gagneet
A: 

Stupid question. Does libapr-1.0.dylib exist?

On my Macbook, /usr/lib/libapr-1.0.dylib is a symbolic link to libapr-1.0.2.7.dylib.

Running nm against that file does show that apr_socket_sendfile is defined in that library.

Also: do standard html pages work properly?

Mike Heinz
A: 

It sounds like either:

  1. The httpd that comes first in your path is not /usr/sbin/httpd, and it was built strangely, or

  2. You have installed something that overwrote either httpd or libapr.

What's the MD5 of your httpd and libapr? I get:

$ openssl md5 /usr/sbin/httpd /usr/lib/libapr-1.0.dylib 
MD5(/usr/sbin/httpd)= d5194790e9cfaca881d0e8fc3db24889
MD5(/usr/lib/libapr-1.0.dylib)= f1f5ece10140a5c2cea2fece7a9e4918
vasi
+3  A: 

I'm having a similar problem and got to this page cause I feel lucky today :) The error means the httpd binary makes reference to a symbol that cannot be found in the appropriate dynamically linked library (libapr in this case, Apache Runtime Library)

Running same OS X version on an iMac. /usr/lib/libapr-1.0.dylib points to the most recent version of the library (1.0.2.12), which does not define the method/symbol _apr_socket_sendfile

The other version of libapr library is 1.0.2.7, does have that symbol. I had the symbolic links point to this version instead (also for libaprutil):

// BEFORE (both 1.0.2.7 and 1.0.2.12 versions exist, symlinks point to .12)
bash-3.2# ls -l libapr*
-rwxr-xr-x  2 userna  wheel  835824 19 Sep  2008 libapr-1.0.2.12.dylib
-rwxr-xr-x  1 root    wheel  578640 24 Sep  2007 libapr-1.0.2.7.dylib
lrwxrwxrwx  1 root    wheel      21 14 Oct  2008 libapr-1.0.dylib -> libapr-1.0.2.12.dylib
lrwxrwxrwx  1 root    wheel      21 14 Oct  2008 libapr-1.dylib -> libapr-1.0.2.12.dylib
-rwxr-xr-x  2 userna  wheel  569544 19 Sep  2008 libaprutil-1.0.2.12.dylib
-rwxr-xr-x  1 root    wheel  393696 24 Sep  2007 libaprutil-1.0.2.7.dylib
lrwxrwxrwx  1 root    wheel      25 14 Oct  2008 libaprutil-1.0.dylib -> libaprutil-1.0.2.12.dylib
lrwxrwxrwx  1 root    wheel      25 14 Oct  2008 libaprutil-1.dylib -> libaprutil-1.0.2.12.dylib

// CHANGE symbolic links to previous version
bash-3.2# ln -sf libapr-1.0.2.7.dylib libapr-1.0.dylib
bash-3.2# ln -sf libapr-1.0.2.7.dylib libapr-1.dylib
bash-3.2# ln -sf libaprutil-1.0.2.7.dylib libaprutil-1.0.dylib
bash-3.2# ln -sf libaprutil-1.0.2.7.dylib libaprutil-1.dylib

// TESTing whether httpd is loaded and run
bash-3.2# /usr/sbin/httpd -t
Syntax OK

Not really sure whether this has been broken since last software update that included Apache Web Server, I rarely use it on this box.

Hope it helps ;)
Jon

Jon
+1  A: 

Have you installed the subversion 1.5 client on your machine? I am seeing the same problem and it seems to be down to this. /usr/lib/libapr-1.0.dylib is normally linked to /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libapr-1.0.2.7.dylib but if you install svn 1.5 it gets re-linked to /opt/subversion/lib/libapr-1.0.2.12.dylib.

The 1.0.2.12 version of the library does not contain the symbol _apr_socket_sendfile.

Having found the problem I'm still trying to figure out how to solve it.

Doug

DougC
+2  A: 

You can try to do the following: 1. backup current apache

sudo cp /usr/sbin/httpd /usr/sbin/httpd.old

2. Replace link in apache binary file to the old library:

sudo install_name_tool -change /usr/lib/libapr-1.0.dylib /usr/lib/libapr-1.0.2.7.dylib /usr/sbin/httpd

After it should work as expected and other applications will still use the new version of libapr

Valerii Hiora
A: 

Thank you Val. install_name_tool -change /usr/lib/libapr-1.0.dylib /usr/lib/libapr-1.0.2.7.dylib /usr/sbin/httpd works great!

stryker