PDA

View Full Version : phpinfo: missing variables



vod
12-28-2005, 01:10 AM
Hi all,

Our phpinfo page does not show the variable HTTP_X_FORWARDED_FOR . when googling around, i saw that many other phpinfo page display such variable and its value. I am actually exploring the ways to log IP of users that are behind proxy and my finding shows that i probably need to play around with REMOTE_ADDR and HTTP_X_FORWARDED_FOR.

my php was compiled using customapache script (./build all). how can i enable HTTP_X_FORWARDED_FOR?

Thank you very much

Chrysalis
12-28-2005, 02:35 AM
I used https to view it (proxyless) and it didnt show, but when I viewed the page with http it showed "HTTP_X_FORWARDED_FOR " with my ip next to it.

Its automatic and wont show if you are not using a proxy server.

vod
12-28-2005, 06:36 AM
Hi,

I do not have HTTP_X_FORWARDED_FOR regardless whether connected using https or http. When i viewed others phpinfo on the net, most of them have that variable with my IP next to it.
They have both REMOTE_ADDR and HTTP_X_FORWARDED_FOR.

Any idea?

Chrysalis
12-28-2005, 08:02 PM
yes quite simple, you are not accessing the page via a proxy server. My isp uses transperent caches and as such I always go through a proxy server. It may also be possible you are using a proxy but it is set not to reveal the true ip (anonymous) this removes the forwarded for information and so it wouldnt show and it would think you are proxyless.

vod
12-29-2005, 12:57 AM
When i viewed others phpinfo on the net, most of them have that variable with my IP next to it.

My IP is clearly there at others phpinfo page HTTPD_X_FORWARDED_FOR, while at my own phpinfo page, i cant find HTTP_X_FORWARDED_FOR.

by the way, i am using transparent proxy i believe. my phpinfo page REMOTE ADDR variables shows my real IP. At others phpinfo page, REMOTE ADDR shows my real IP too and HTTPD_X_FORWARDED_FOR shows both my real IP and my proxy

Chrysalis
12-29-2005, 04:28 PM
ok I understand now sorry.

can you post your configure switches used for compiling php? They are shown on the top of phpinfo and also are in /usr/local/directadmin/customapache/configure.php

vod
12-29-2005, 05:28 PM
Hi Chrys,

Thanks for helping. Below is my configure.php:

#!/bin/sh
./configure \
--with-apxs \
--with-curl \
--with-curl-dir=/usr/local/lib \
--with-gd \
--with-gd-dir=/usr/local \
--with-gettext \
--with-jpeg-dir=/usr/local/lib \
--with-kerberos \
--with-mcrypt \
--with-mhash \
--with-mysql=/usr \
--with-pear \
--with-png-dir=/usr/local/lib \
--with-xml \
--with-zlib \
--with-zlib-dir=/usr/local/lib \
--with-zip \
--with-openssl \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-track-vars \
--enable-mbstring \
--enable-memory-limit

I always rm configure.php before compile apache and php so i believe that is the latest configure.php from DA.

again, thanks for looking into this.

Chrysalis
12-30-2005, 03:37 AM
having 2nd thoughts best give me url to your phpinfo, in pm if you wish, lets see if it shows the right info for me using a proxy.

vod
12-30-2005, 04:28 AM
Hi Chrys,

I think it is because of my htaccess file. once i removed the file, i can see http_x_forwarded_for

thanks