Re[2]: [PHP-WIN] REMOTE_ADDR problem in CGI mode
| From: | Pablo Vera | Date: | Fri, 01 Dec 2000 00:17:25 +0000 |
| Subject: | Re[2]: [PHP-WIN] REMOTE_ADDR problem in CGI mode | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-4211@lists.php.net to get a copy of this message | ||
Vince:
My system: Apache 1.3.12, PHP 4.0.3pl1 (from www.php.net), Windows 98.
I have PHP both, as CGI and module. CGI handles .cphp files, while
the module handles .php, .php3 and .php4 files.
At the end of my "httpd.conf" file I have:
Include conf/php.conf
in my "Apache/conf" directory I have the file "php.conf" with this:
# PHP SETUP
# PHP 4.0.3 pl1 Module (BEGIN)
#
LoadModule php4_module modules/php4apache.dll
AddType application/x-httpd-php .php .php4 .php3
#
# PHP 4.0.3 pl1 Module (END)
# PHP 4.0.3 pl1 CGI (BEGIN)
#
ScriptAlias /cphp/ "C:/Php4/"
AddType application/x-httpd-cphp .cphp
Action application/x-httpd-cphp "/cphp/php.exe"
#
# PHP 4.0.3 pl1 CGI (END)
PHP configuration is done in this file and not in "httpd.conf", so it
is easier and I don't get confused.
I use two "php.ini" files, one located in "C:\Php4" (for the CGI) and
the other located in "C:\Apache" (for the module). I do this because I
need to load the GD library for the CGI, but not for the module.
On both "php.ini" I have register_globals = On
I don't have problems with REMOTE_ADDR, so I hope this helps.
Saludos,
Pablo Vera
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Thursday, November 30, 2000, 5:44:05 PM, Vince wrote:
VL> On 2000-11-30, Pablo Vera stated:
VL> Hi Pablo,
VL> } Try using $GLOBALS:
VL> }
VL> } $r_hostname = gethostbyaddr($GLOBALS["REMOTE_ADDR"]);
VL> I get the same error, "Undefined index: REMOTE_ADDR" :-(
VL> } When running as CGI, $HTTP_SERVER_VARS only has "PHP_SELF".
VL> What is strange though, is that I've run this in CGI mode before and it
VL> has worked [using $HTTP_SERVER_VARS], as well as in module mode. It is
VL> just when I run php in both modes that I have the problem.
VL> I am developing code that has to run as both a php module and as CGI, so
VL> I'd like to make sure I don't have to have two different versions of my
VL> code to run for cgi and module.
VL> /vjl/