Link to home
Start Free TrialLog in
Avatar of Kyanzes
Kyanzes

asked on

$_SERVER["HTTP_CLIENT_IP"] causes error in FastCGI mode

So, I have a piece of code that worked perfectly up until now, that is, under ISAPI mode.

Now I have installed PHP in FastCGI and the following code no longer works:

$cip = $_SERVER["HTTP_CLIENT_IP"] ;

The PHP version is 5.2.9-2 for both installations (the old ISAPI and the current FastCGI).

The error thrown:

Client found response content type of '', but expected 'text/xml'. The request failed with the error message: -- PHP Warning: Call-time pass-by-reference has been deprecated in C:\inetpub\wwwroot\TEST\WS\wsdatahandler.php on line 781 PHP Warning: Call-time pass-by-reference has been deprecated in C:\inetpub\wwwroot\TEST\WS\wsdatahandler.php on line 781 PHP Warning: Call-time pass-by-reference has been deprecated in C:\inetpub\wwwroot\TEST\WS\wsdatahandler.php on line 894 PHP Warning: Call-time pass-by-reference has been deprecated in C:\inetpub\wwwroot\TEST\WS\wsdatahandler.php on line 897 PHP Warning: Call-time pass-by-reference has been deprecated in C:\inetpub\wwwroot\TEST\WS\wsdatahandler.php on line 897 PHP Notice: Undefined index: HTTP_CLIENT_IP in C:\inetpub\wwwroot\TEST\WS\wshandler.php on line 225 PHP Notice: Undefined index: HTTP_X_FORWARDED_FOR in C:\inetpub\wwwroot\TEST\WS\wshandler.php on line 225 --.

PHP version is unchanged, IIS is unchanged.

What could be the root of the problem???

ASKER CERTIFIED SOLUTION
Avatar of Beverley Portlock
Beverley Portlock
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
user  $_SERVER['REMOTE_ADDR']

Hope this helps,
Addy
I should also point out that the bulk of the errors listed have nothing to do with the $_SERVER["HTTP_CLIENT_IP"]  error. They refer to a different problem. You used to be able to do this

myFunction( & $aVariable );

forcing a "call by reference" at runtime. This has also been outlawed in newer versions of PHP and you must declare the call-by-reference in the function definition instead like so

function myFunction( & $param ) {
....code....
}


myFunction( $aVariable );
Avatar of Kyanzes
Kyanzes

ASKER

Thanks.