Getting Local Ip

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kardon33
    New Member
    • May 2007
    • 158

    Getting Local Ip

    How would i find the Ip address of the server running the script.
  • mwasif
    Recognized Expert Contributor
    • Jul 2006
    • 802

    #2
    you can try with this

    [PHP]echo $_SERVER['SERVER_ADDR'];[/PHP]

    Comment

    • nomad
      Recognized Expert Contributor
      • Mar 2007
      • 664

      #3
      Originally posted by kardon33
      How would i find the Ip address of the server running the script.
      you could use
      HostName Lookups which will request a reverse DNS lookup meaning that Apache will find ou the hostname from the IP and then will try to find the IP from the hostname.

      Logformat is good to
      %a remote IP address from the client
      %h Hostname or IP addres of the client making the request

      %A local IP address from the server

      So it might look like this
      LogFormat "%a %h %A" common

      nomad

      Comment

      Working...