joe92 joe92 - 4 months ago 31
PHP Question

PHP Notice: Undefined index: HTTP_HOST in /var/.../script.php on line 8

I am getting the same error in my apache error log as described in this question. The only difference is that I am using $_SERVER as described in the answer.

Line 8 is:


The same error appears for line 59 which has the exact same conditional. It's a conditional to tell the website whether we are in sandboxing or not. As far as I can tell nothing bad is happened except it is clogging up the apache error log.

Does anyone know why this is happening and how to fix it? The PHP version is 5.3.10. The server is running Ubuntu 12.04.

Thank you.


The manual implies this index may not always be set

Contents of the Host: header from the current request, if there is one.