apache_mod_loaded()
Determines whether the specified module exist in the Apache config.
No Hooks.
Return
true|false
. Whether the specified module is loaded.
Usage
apache_mod_loaded( $mod, $default );
- $mod(string) (required)
- The module, e.g. mod_rewrite.
- $default(true|false)
- The default return value if the module is not found.
Default: false
Notes
- Global. true|false. $is_apache
Changelog
Since 2.5.0 | Introduced. |
apache_mod_loaded() apache mod loaded code WP 6.1.1
function apache_mod_loaded( $mod, $default = false ) { global $is_apache; if ( ! $is_apache ) { return false; } $loaded_mods = array(); if ( function_exists( 'apache_get_modules' ) ) { $loaded_mods = apache_get_modules(); if ( in_array( $mod, $loaded_mods, true ) ) { return true; } } if ( empty( $loaded_mods ) && function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) { ob_start(); phpinfo( INFO_MODULES ); $phpinfo = ob_get_clean(); if ( false !== strpos( $phpinfo, $mod ) ) { return true; } } return $default; }