echo $_SERVER['SERVER_ADDR']
always yields 192.168.1.142
, which is the IP address of my server within my home network. I can access the website using my external IP since I've set up the port forward on my router, but $_SERVER['SERVER_ADDR']
will only return the internal IP, no matter what I try.
How can I make $_SERVER['SERVER_ADDR']
return my external IP?