src/Validator.php
public static function getWebServerSoftWare() : string
    {
        static $type;

        if (isset($type)) {
            return $type;
        }

        $software = isset($_SERVER['SERVER_SOFTWARE'])
            ? $_SERVER['SERVER_SOFTWARE']
            : null;

        $type = self::SERVER_TYPE_UNKNOWN;

        if (stripos($software, 'lighttpd') !== false) {
            $type = self::SERVER_TYPE_LIGHTTPD;
        }

        if (strpos($software, 'Hiawatha') !== false) {
            $type = self::SERVER_TYPE_HIAWATHA;
        }

        if (strpos($software, 'Apache') !== false) {
            $type = self::SERVER_TYPE_APACHE;
        } elseif (strpos($software, 'Litespeed') !== false) {
            $type = self::SERVER_TYPE_LITESPEED;
        }

        if (strpos($software, 'nginx') !== false) {
            $type = self::SERVER_TYPE_NGINX;
        }

        if ($type !== self::SERVER_TYPE_APACHE && $type !== self::SERVER_TYPE_LITESPEED
            && strpos($software, 'Microsoft-IIS') !== false
            && strpos($software, 'ExpressionDevServer') !== false
        ) {
            $type = self::SERVER_TYPE_IIS;
            if (intval(substr($software, strpos($software, 'Microsoft-IIS/')+14)) >= 7) {
                $type = self::SERVER_TYPE_IIS7;
            }
        }
        if (function_exists('apache_get_modules')) {
            if (in_array('mod_security', apache_get_modules())) {
                $type = self::SERVER_TYPE_APACHE;
            }

            if ($type == self::SERVER_TYPE_UNKNOWN && function_exists('apache_get_version')) {
                $type = self::SERVER_TYPE_APACHE;
            }
        }

        return $type;
    }
public static function getWebServerSoftWare() : string
    {
        static $type;

        if (isset($type)) {
            return $type;
        }

        $software = isset($_SERVER['SERVER_SOFTWARE'])
            ? $_SERVER['SERVER_SOFTWARE']
            : null;

        $type = self::SERVER_TYPE_UNKNOWN;

        if (stripos($software, 'lighttpd') !== false) {
            $type = self::SERVER_TYPE_LIGHTTPD;
        }

        if (strpos($software, 'Hiawatha') !== false) {
            $type = self::SERVER_TYPE_HIAWATHA;
        }

        if (strpos($software, 'Apache') !== false) {
            $type = self::SERVER_TYPE_APACHE;
        } elseif (strpos($software, 'Litespeed') !== false) {
            $type = self::SERVER_TYPE_LITESPEED;
        }

        if (strpos($software, 'nginx') !== false) {
            $type = self::SERVER_TYPE_NGINX;
        }

        if ($type !== self::SERVER_TYPE_APACHE && $type !== self::SERVER_TYPE_LITESPEED
            && strpos($software, 'Microsoft-IIS') !== false
            && strpos($software, 'ExpressionDevServer') !== false
        ) {
            $type = self::SERVER_TYPE_IIS;
            if (intval(substr($software, strpos($software, 'Microsoft-IIS/')+14)) >= 7) {
                $type = self::SERVER_TYPE_IIS7;
            }
        }
        if (function_exists('apache_get_modules')) {
            if (in_array('mod_security', apache_get_modules())) {
                $type = self::SERVER_TYPE_APACHE;
            }

            if ($type == self::SERVER_TYPE_UNKNOWN && function_exists('apache_get_version')) {
                $type = self::SERVER_TYPE_APACHE;
            }
        }

        return $type;
    }
public static function getWebServerSoftWare ( ) : string { static $ type ; if ( isset ( $ type ) ) { return $ type ; } $ software = isset ( $ _SERVER [ 'SERVER_SOFTWARE' ] ) ? $ _SERVER [ 'SERVER_SOFTWARE' ] : null ; $ type = self :: SERVER_TYPE_UNKNOWN ; if ( stripos ( $ software , 'lighttpd' ) !== false ) { $ type = self :: SERVER_TYPE_LIGHTTPD ; } if ( strpos ( $ software , 'Hiawatha' ) !== false ) { $ type = self :: SERVER_TYPE_HIAWATHA ; } if ( strpos ( $ software , 'Apache' ) !== false ) { $ type = self :: SERVER_TYPE_APACHE ; } elseif ( strpos ( $ software , 'Litespeed' ) !== false ) { $ type = self :: SERVER_TYPE_LITESPEED ; } if ( strpos ( $ software , 'nginx' ) !== false ) { $ type = self :: SERVER_TYPE_NGINX ; } if ( $ type !== self :: SERVER_TYPE_APACHE && $ type !== self :: SERVER_TYPE_LITESPEED && strpos ( $ software , 'Microsoft-IIS' ) !== false && strpos ( $ software , 'ExpressionDevServer' ) !== false ) { $ type = self :: SERVER_TYPE_IIS ; if ( intval ( substr ( $ software , strpos ( $ software , 'Microsoft-IIS/' ) + 14 ) ) >= 7 ) { $ type = self :: SERVER_TYPE_IIS7 ; } } if ( function_exists ( 'apache_get_modules' ) ) { if ( in_array ( 'mod_security' , apache_get_modules ( ) ) ) { $ type = self :: SERVER_TYPE_APACHE ; } if ( $ type == self :: SERVER_TYPE_UNKNOWN && function_exists ( 'apache_get_version' ) ) { $ type = self :: SERVER_TYPE_APACHE ; } } return $ type ; }
Get Web Server Type

@return string
Get Web Server Type