Tuesday, April 21, 2020

Fix PHP Notice: Undefined index: HTTP_HOST in php on line

It might be that $_SERVER['HTTP_HOST'] is undefined.

To check this, better to verify using isset before instantiating it:


$link .= "http://";

if (isset($_SERVER['HTTP_HOST'])) {
        $link .= $_SERVER['HTTP_HOST'];
}

No comments:

Post a Comment