Zen Cart Logo
Forums / Basic Configuration / REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

Locked

Views: 12,254

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
24 Sep 2007, 10:30 PM
#1
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

I've turned off showing IP address at the footer for some time and had it turned on couple days ago to find out it only displays 0.0.0.0. So I've turned it off until problem gets resolved.

I also get 0.0.0.0 on who's online under Admin/Tools.

What would cause $ip = $_SERVER['REMOTE_ADDR'] to get only 0.0.0.0?

If you must ask what contributions I've installed, there are about 50 of them (pretty much everything from the download section). They all work fine and most of them use overrides and I don't remember touching display ip section. (I can almost guarantee particular code hasn't been touched).

Again, what would have caused $ip = $_SERVER['REMOTE_ADDR'] not to obtatin proper client IP??

24 Sep 2007, 11:03 PM
#2
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

SteveKim:

I've turned off showing IP address at the footer for some time and had it turned on couple days ago to find out it only displays 0.0.0.0. So I've turned it off until problem gets resolved.

I also get 0.0.0.0 on who's online under Admin/Tools.

What would cause $ip = $_SERVER['REMOTE_ADDR'] to get only 0.0.0.0?

If you must ask what contributions I've installed, there are about 50 of them (pretty much everything from the download section). They all work fine and most of them use overrides and I don't remember touching display ip section. (I can almost guarantee particular code hasn't been touched).

Again, what would have caused $ip = $_SERVER['REMOTE_ADDR'] not to obtatin proper client IP??

I just realized it is to do with mod_proxy of Apache.
Any workarounds in using mod_proxy with Remote_addr?

24 Sep 2007, 11:07 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

Try using zen_get_ip_address() instead of $_SERVER['REMOTE_ADDR']

24 Sep 2007, 11:53 PM
#4
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

DrByte:

Try using zen_get_ip_address() instead of $_SERVER['REMOTE_ADDR']

Dr Byte,

I've added couple things under tpl_footer.php just to see what values these variables return as zen_get_ip_address() also returned only 0.0.0.0 as below:

<div id="siteinfoIP"><?php echo TEXT_YOUR_IP_ADDRESS . '  ' . 'server forwarded: ' .  
$_SERVER['HTTP_X_FORWARDED_FOR'] . ' server client ip: '. $_SERVER['HTTP_CLIENT_IP'] . 'get 
forwarded: ' . getenv('HTTP_X_FORWARDED_FOR') . 'get client ip: ' . getenv('HTTP_CLIENT_IP') . 
'get remote addr: ' . getenv('REMOTE_ADDR') . 'zen ip func: ' . zen_get_ip_address(); ?></div>

and it returns below:

Your IP Address is: server forwarded: server client ip: get forwarded: get client ip: get remote addr: 0.0.0.0zen ip func: 0.0.0.0

Any other suggestions?

25 Sep 2007, 2:42 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

SteveKim:

I just realized it is to do with mod_proxy of Apache.
Any workarounds in using mod_proxy with Remote_addr?

SteveKim:

Any other suggestions?Other than turning it off? No.
If the proxy isn't passing the information through, then there's no way of knowing.
Why do you need the mod_proxy installed anyway?

25 Sep 2007, 5:14 PM
#6
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

DrByte:

Other than turning it off? No.
If the proxy isn't passing the information through, then there's no way of knowing.
Why do you need the mod_proxy installed anyway?

Well, I'm sure you'd understand that all business necessities are different.

Mine here has couple of almost inavtive 'old' asp sites (not aspx) that is maintained by some other person whose main job is not to maintain asp sites and those sites are not justifiable in spending extra dollar to convert to anything else like php.

In other words, asp sites require IIS, IIS and Apache cannot be hosted at the same server, .aspx mod in Apache is available but not .asp hence Apache is proxying IIS sites. So we need it.

Then here is another question that's not quite appropriate in this Zen Cart forum. Will X-Forwarded-For require another Apache module installed? Could this requirement being not in place probably cause X-Forwarded-For variable not available?

Thanks,

Steve Kim.

26 Sep 2007, 1:55 AM
#7
stuff4toys avatar

stuff4toys

Totally Zenned

Join Date:
May 2007
Location:
SW Florida
Posts:
1,062
Plugin Contributions:
1

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

DrByte:

Try using zen_get_ip_address() instead of $_SERVER['REMOTE_ADDR']
I have the same problem. Tried this and no go.
WinXP wamp 5, don't know anything about mod_proxy, looked at the Apache server settings and proxy_module nor any of the other proxy options are turned on.

JOhn ><>

26 Sep 2007, 6:47 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

SteveKim:

Well, I'm sure you'd understand that all business necessities are different.Exactly. Hence the question.
SteveKim:

Mine here has couple of almost inavtive 'old' asp sites (not aspx) that is maintained by some other person whose main job is not to maintain asp sites and those sites are not justifiable in spending extra dollar to convert to anything else like php.

In other words, asp sites require IIS, IIS and Apache cannot be hosted at the same server, .aspx mod in Apache is available but not .asp hence Apache is proxying IIS sites. So we need it.

SteveKim:

Then here is another question that's not quite appropriate in this Zen Cart forum. Will X-Forwarded-For require another Apache module installed? Could this requirement being not in place probably cause X-Forwarded-For variable not available?

I'm not sure -- I've not used the mod_proxy addon in order to know.

FWIW, Zen Cart checks all those variations in its get_ip_address function```
function zen_get_ip_address() {
if (isset($_SERVER)) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} elseif (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
}
} else {
if (getenv('HTTP_X_FORWARDED_FOR')) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
} elseif (getenv('HTTP_CLIENT_IP')) {
$ip = getenv('HTTP_CLIENT_IP');
} else {
$ip = getenv('REMOTE_ADDR');
}
}

return $ip;

}


You may have to take your question to a webhosting discussion forum like webhostingtalk.com where you can "talk shop" with folks running servers more actively.
26 Sep 2007, 5:27 PM
#9
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

DrByte:

You may have to take your question to a webhosting discussion forum like webhostingtalk.com where you can "talk shop" with folks running servers more actively.

Thank you, Dr. Byte. We all must do.

I'll post once it's resolved.

Just another note: the zen cart sites are not proxied and this is happening. The environment is mod_proxy loaded here.

8 Oct 2007, 6:33 PM
#10
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

I've got it resolved by searching through apache lounge at http://www.apachelounge.com/forum/viewtopic.php?p=7476

It probably applies only to my environment that is Win2K server with mod_proxy (proxy_html) though.

The resolution:

Simply add following to anywhere in httpd.conf, of which in my case, at the end of the file:

Win32DisableAcceptEx

More about it on http://httpd.apache.org/docs/2.0/mod/mpm_winnt.html
Hope this helps others whom having the problem!

8 Oct 2007, 7:35 PM
#11
stuff4toys avatar

stuff4toys

Totally Zenned

Join Date:
May 2007
Location:
SW Florida
Posts:
1,062
Plugin Contributions:
1

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

SteveKim:

The resolution:
Simply add following to anywhere in httpd.conf, of which in my case, at the end of the file:

Win32DisableAcceptEx

More about it on http://httpd.apache.org/docs/2.0/mod/mpm_winnt.html
Hope this helps others whom having the problem!

PERFECTO!!! You are good, I was going to let it slide and just turned it off in the admin, but now yee haw it works.

Thank You, Thank You, Thank You
JOhn ><>

9 Oct 2007, 4:27 PM
#12
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

LibertyFlag:

PERFECTO!!! You are good, I was going to let it slide and just turned it off in the admin, but now yee haw it works.

Thank You, Thank You, Thank You
JOhn ><>

I'm glad it helped!:smile:

13 Oct 2007, 7:34 PM
#13
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

-Latest update on Oct 13, 2007-

Read this forum post from Apache Lounge:
http://www.apachelounge.com/forum/viewtopic.php?p=8937

It basically further addresses having another problem of PHP Fatal Error by having Win32DisableAcceptEx apache directive.

My solution:
Remove Win32DisableAcceptEx directive from httpd.conf if you did put it already, and upgrade to Apache 2.2.6.

Having Windows 2000 server is the only environment that has 0.0.0.0 problem and upgrading to latest Apache release of 2.2.6 will have it fixed. Download the version from Apache Lounge, not the binary from ASP.

Regards,

Steve Kim.

15 Oct 2007, 1:40 PM
#14
stuff4toys avatar

stuff4toys

Totally Zenned

Join Date:
May 2007
Location:
SW Florida
Posts:
1,062
Plugin Contributions:
1

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

I did notice that after I put "Win32DisableAcceptEx" in the httpd.conf that my memory usage started climbing out of control.

300 - 1000 hits a day the memory usage on the server will jump from 300MB to over 700MB in just a few days. Restart the Services and the memery drops back down again. Before doing this the server ran for months without a complaint.

Even though the machine has 1.5GB ram, Apache seems to quit serving php web pages at about 750MB of usage.

I will check into the Apache upgrade from 2.2.4 to 2.2.6 right away.

THANKS SteveKim
JOhn ><>

16 Oct 2007, 4:31 PM
#15
stevekim avatar

stevekim

New Zenner

Join Date:
Apr 2007
Location:
Los Angeles, CA
Posts:
44
Plugin Contributions:
0

Re: REMOTE_ADDR displays only 0.0.0.0 -- mod_proxy special config on Windows

LibertyFlag:

I did notice that after I put "Win32DisableAcceptEx" in the httpd.conf that my memory usage started climbing out of control.

300 - 1000 hits a day the memory usage on the server will jump from 300MB to over 700MB in just a few days. Restart the Services and the memery drops back down again. Before doing this the server ran for months without a complaint.

Even though the machine has 1.5GB ram, Apache seems to quit serving php web pages at about 750MB of usage.

I will check into the Apache upgrade from 2.2.4 to 2.2.6 right away.

THANKS SteveKim
JOhn ><>

Some forums say it's php 5.2.x bug, some say it's php 5.x.x bug, but I say it's Apache. With Apache 2.2.6 (from Apache Lounge, not ASP), Win32DisableAcceptEx can be opted out. With it, yes the memory usage jumps and php begins to generate errors. I guess it stacks up in the memory.

However, with 2.2.6 and Win32DisableAcceptEx opted out, you will notice there are winnt_accept: Asynchronous AcceptEx failed errors on Apache log that you can ignore.

It's been about a week with 2.2.6 and there isn't any issues.

SK.