How to identify server IP address in PHP

pooja picture pooja · Apr 27, 2011 · Viewed 224.9k times · Source

How can I identify the server IP address in PHP?

Answer

CloudyMarble picture CloudyMarble · Apr 27, 2011

Like this for the server ip:

$_SERVER['SERVER_ADDR'];

and this for the port

$_SERVER['SERVER_PORT'];