I am getting an undefined index on my config page and it reads:
Notice: Undefined index: SERVER_ADDR in inc/config .inc.php on line 3
Any idea on how I can fix that? I know its warning, but would still like to get at it. I am using it to check for the address whether to use my local or remote config settings.
I am using it in this context:
if ($_SERVER['SERVER_ADDR'] == '127.0.0.1' || $_SERVER['SERVER_NAME'] == 'localhost') {
}
The accepted answer is correct, but take note that on Windows IIS 7 (and above, to the best of my knowledge) you must use:
$_SERVER['LOCAL_ADDR']
instead of
$_SERVER['SERVER_ADDR']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With