|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18379 Can't get IP when using SAPI
Submitted: 2002-07-16 17:24 UTC Modified: 2002-07-17 07:41 UTC
From: picklezz at hotmail dot com Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.2.1 OS: Windows XP Pro
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: picklezz at hotmail dot com
New email:
PHP Version: OS:


 [2002-07-16 17:24 UTC] picklezz at hotmail dot com
When I install PHP 4.2.1 as a SAPI module to Apache 2.0.39 I haven't had any problems with any of my scripts until I was going to log the IP of my visitors. So I used the fallowing 'script' to get the IP's... <?
echo 'REMOTE_ADDR:' . getenv(REMOTE_ADDR);

It won't return anything at all just a empty string...
So I tried to install PHP with the CGI support using:


ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"

instead of (Conf. for SAPI):


LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php

Now when I use the same 'script' as above I get both the REMOTE_ADDR and the HTTP_X_FORWARDED_FOR correct...


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-16 17:27 UTC]
Apache problem, not PHP.

(Free Tip Of The Day: Apache 2 is NOT really ready for production boxes)

 [2002-07-17 07:41 UTC] picklezz at hotmail dot com
Well it's working with PHP 4.3.0-dev and Apache 2.0.39 so it should be a PHP (but also it seems that you fixed this in PHP 4.3.0-dev so it should be finish...)
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jan 31 00:05:52 2023 UTC