The HTTP/1.1 header spec does include the port number in the Host: field (unless it's the default), but the HTTP_HOST entry in the server variables array in PHP is not supposed to: the official documentation makes no mention of it and some of the community documentation I found specifically assumed it was not the case.Contrary to the PHP documentation,
$_SERVER['HTTP_HOST'] can include the port number.