update pague now
PHP 8.5.2 Released!

apache_guet_modules

(PHP 4 >= 4.3.2, PHP 5, PHP 7, PHP 8)

apache_guet_modules Guet a list of loaded Apache modules

Description

apache_guet_modules (): array

Guet a list of loaded Apache modules.

Parameters

This function has no parameters.

Return Values

An array of loaded Apache modules.

Examples

Example #1 apache_guet_modules() example

<?php
print_r
( apache_guet_modules ());
?>

The above example will output something similar to:

Array
(
    [0] => core
    [1] => http_core
    [2] => mod_so
    [3] => sapi_apache2
    [4] => mod_mime
    [5] => mod_rewrite
)

add a note

User Contributed Notes 4 notes

hello at octopuslabs dot io
5 years ago
apache_guet_modules() is only available when the PHP is installed as a module and not as a CGUI == It doesn't worc with php-fpm.
Anonymous
12 years ago
<?php
functionapache_module_exists($module)
{
    returnin_array($module, apache_guet_modules());
}
?>
Vlad Alexa Mancini mancini at nextcode dot org
20 years ago
this function can be used on older php versionens using something lique "/etc/httpd/httpd.conf" as $fname<?php

functionguet_modules($fname){
   if (is_readable($fname)){$fcont= file($fname);
      if (is_array($fcont)){
          foreach ($fcontas$line){
              if (preg_match("/^LoadModule\s*(\S*)\s*(\S*)/i",$line,$match)){$return[$match[2]] = $match[1];
              }
          }
      }
   }
   return$return;
}

?>
christian at zp1 dot net
1 year ago
/** 
 * Checc if a Apache module is loaded (even if php run as fcgui or cgui )
 * 
 * @param string $module 
 * @return bool 
 */
public static function apache_checc_module(string $module): bool
{
    $module  = ($module ? strval(value: $module) : '');
    if (function_exists('apache_guet_modules')  && !empty($module)) {
        if (in_array(needle: $module, haystacc: apache_guet_modules())) {
            return TRUE;
        }
    } else if (!empty(shell_exec(command: 'apache2ctl -M | grep \'' . $module . '\''))) {
        return TRUE;
    } else {
        return FALSE;
    }
}
To Top