Topic : REMOTE_ADDR on os x

Topic Archived This topic has been archived - replies are not allowed.


This question is not answered. "Helpful" answers available: 2 . "Solved" answers available: 1 .



            Permlink
            Replies : 5 - Pages : 1 - Last Post : Jan 18, 2006 9:51 PM by: stevenschopp
stevenschopp

Posts: 11
Registered: Jan 17, 2006
REMOTE_ADDR on os x
Posted: Jan 17, 2006 11:11 AM
 

I am trying to put a counter on my site, I need to use the REMOTE_ADDR php parameter. In os x this returns the servers ip address instead of the clients ip address. I read that prior to tiger you could use HTTP_PC_REMOTE_ADDR, but this dose not seem to work anymore. what parameter will return the users ip in os x 10.4.3 Client?

G5   Mac OS X (10.4.3)  
jaydisc


Posts: 898
From: Melbourne, Australia
Registered: May 13, 2002
Re: REMOTE_ADDR on os x
Posted: Jan 17, 2006 3:23 PM   in response to: stevenschopp
 

This command works beautifully for me with the stock PHP in 10.4.4:

<?php echo $_SERVER['REMOTE_ADDR']; ?>

Are you sure you're not possibly access the server VIA the server? (e.g. NAT, Proxy, etc.)

PowerBook G4 12" 867 MHz   Mac OS X (10.4.3)   1 GB, 60 GB, AirPort Extreme, Bluetooth
stevenschopp

Posts: 11
Registered: Jan 17, 2006
Re: REMOTE_ADDR on os x
Posted: Jan 18, 2006 4:43 AM   in response to: jaydisc
 

Yes I am sure, my visitors also log as the server ip. what's NAT and Proxy?

G5   Mac OS X (10.4.3)  
jaydisc


Posts: 898
From: Melbourne, Australia
Registered: May 13, 2002
Re: REMOTE_ADDR on os x
Posted: Jan 18, 2006 4:52 AM   in response to: stevenschopp
 

If you aren't sure about NAT and Proxy, you probably aren't running them.

Are you using the installation of PHP that came with OS X Server? Or have you installed one from another location?

PowerBook G4 12" 867 MHz   Mac OS X (10.4.3)   1 GB, 60 GB, AirPort Extreme, Bluetooth
Camelot


Posts: 9,713
From: San Jose, CA
Registered: Mar 13, 2002
Re: REMOTE_ADDR on os x
Posted: Jan 18, 2006 9:58 AM   in response to: stevenschopp
 

Turn off the performance cache in Server Admin -> Web -> Settings -> Sites -> Options

This acts as a proxy server in front of Apache to improve performance of certain files. However, one side effect is that Apache sees the IP address of the proxy server not the IP address of the user.

Performance cache or remote IP addresses. Pick one. You can't have both :)

In most cases, turning off the performance cache is what most people opt for. The performance gains are usually modest.

  Mac OS X (10.4.4)  
stevenschopp

Posts: 11
Registered: Jan 17, 2006
Re: REMOTE_ADDR on os x
Posted: Jan 18, 2006 9:51 PM   in response to: Camelot
 

I thought that might be the problem. I'm not running os x server, I am
running os x client as a server, so I can not use server admin. Is there
a way to turn off the performance cache other than server admin?

G5   Mac OS X (10.4.3)   OS x - Client, PHP/4.3.11, Apache/1.3.3