Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Apache-specific Functions : apache_get_modules

apache_get_modules

Get a list of loaded Apache modules (PHP 4 >= 4.3.2, PHP 5)
array apache_get_modules ( )

Example 201. apache_get_modules() example

<?php
print_r
(apache_get_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
)

Code Examples / Notes » apache_get_modules

hazem dot khaled

to check if one module loaded before use it
<?php
function apache_is_module_loaded($mod_name)
{
$modules = apache_get_modules();
if (in_array($mod_name, $modules))
{
return true;
}
else
{
return false;
}
}
?>


vlad alexa mancini mancini

this function can be used on older php versions using something like "/etc/httpd/httpd.conf" as $fname
<?php
function get_modules ($fname){
  if (is_readable($fname)){
     $fcont = file($fname);
     if (is_array($fcont)){
         foreach ($fcont as $line){
             if (preg_match ("/^LoadModule\s*(\S*)\s*(\S*)/i",$line,$match)){
                 $return[$match[2]] = $match[1];
             }
         }
     }
  }
  return $return;
}
?>


Change Language


Follow Navioo On Twitter
apache_child_terminate
apache_get_modules
apache_get_version
apache_getenv
apache_lookup_uri
apache_note
apache_request_headers
apache_reset_timeout
apache_response_headers
apache_setenv
ascii2ebcdic
ebcdic2ascii
getallheaders
virtual
eXTReMe Tracker