add IPv6 support

This commit is contained in:
coderkun 2014-08-09 00:33:11 +02:00
parent fdb115083e
commit 12ae8b180e
2 changed files with 13 additions and 2 deletions

View file

@ -124,7 +124,18 @@
*/
private function getAutoLogMode()
{
return ($_SERVER['SERVER_ADDR'] == '127.0.0.1' && !$this->autoLogToScreenDisabled) ? self::LOGMODE_SCREEN : self::LOGMODE_PHP;
return ($this->isLocalhost() && !$this->autoLogToScreenDisabled) ? self::LOGMODE_SCREEN : self::LOGMODE_PHP;
}
/**
* Detect if the server is running as localhost without domain.
*
* @return boolean Wheather server is running as localhost or not
*/
private function isLocalhost()
{
return ($_SERVER['SERVER_ADDR'] == '127.0.0.1' || $_SERVER['SERVER_ADDR'] = '::1');
}
}

View file

@ -25,7 +25,7 @@
/**
* De-/Activate error messages
*/
if($_SERVER['SERVER_ADDR'] == '127.0.0.1') {
if($_SERVER['SERVER_ADDR'] == '127.0.0.1' || $_SERVER['SERVER_ADDR'] == '::1') {
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 0);