apache_mod_loaded

Does the specified module exist in the Apache config?.

Description

apache_mod_loaded( (string) $mod, (constant) $default = false ); 

Parameters (2)

0. $mod (string)
E.g. mod_rewrite
1. $default — Optional. (constant) => false
The default return value if the module is not found

Usage

  1. if ( !function_exists( 'apache_mod_loaded' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/backpress/functions.core.php'; 
  3.  
  4. // e.g. mod_rewrite 
  5. $mod = ''; 
  6.  
  7. // The default return value if the module is not found 
  8. $default = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = apache_mod_loaded($mod, $default); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/backpress/functions.core.php  
  1. function apache_mod_loaded($mod, $default = false) { 
  2. global $is_apache; 
  3.  
  4. if ( !$is_apache ) 
  5. return false; 
  6.  
  7. if ( function_exists('apache_get_modules') ) { 
  8. $mods = apache_get_modules(); 
  9. if ( in_array($mod, $mods) ) 
  10. return true; 
  11. } elseif ( function_exists('phpinfo') ) { 
  12. ob_start(); 
  13. phpinfo(8); 
  14. $phpinfo = ob_get_clean(); 
  15. if ( false !== strpos($phpinfo, $mod) ) 
  16. return true; 
  17. return $default;