Make WordPress Core


Ignore:
Timestamp:
03/21/2008 04:10:01 AM (19 years ago)
Author:
markjaquith
Message:

better Apache mod detection from andy. fixes #6278

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r7440 r7441  
    17181718        return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
    17191719}
     1720
     1721/**
     1722 * apache_mod_loaded() - Does the specified module exist in the apache config?
     1723 *
     1724 * @param string $mod e.g. mod_rewrite
     1725 * @return bool
     1726 */
     1727function apache_mod_loaded($mod) {
     1728        global $is_apache;
     1729
     1730        if ( !$is_apache )
     1731                return false;
     1732
     1733        if ( function_exists('apache_get_modules') ) {
     1734                $mods = apache_get_modules();
     1735                if ( in_array($mod, $mods) )
     1736                        return true;
     1737        } else {
     1738                        ob_start();
     1739                        phpinfo(8);
     1740                        $phpinfo = ob_get_clean();
     1741                        if ( false !== strpos($phpinfo, $mod) )
     1742                                return true;
     1743        }
     1744        return false;
     1745}
     1746
    17201747?>
Note: See TracChangeset for help on using the changeset viewer.