1

I am running a PHP script over PLESK that runs PHP codes via fastcgi to php feature.

everything works well but when I want to get USER IP address via this code

$_SERVER['SERVER_ADDR']

I encounter this error message :

Notice: Undefined index: SERVER_ADDR

It seems server variables are not available in PHP that runs over PLESK CGI

Please help me, if I want to get user IPs via php code, what should I do?

Mehrdad201
  • 121
  • 9

1 Answers1

3

The user's IP is in $_SERVER['REMOTE_ADDR'], not SERVER_ADDR.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368