|
apache_get_modules
Get a list of loaded Apache modules
(PHP 4 >= 4.3.2, PHP 5)
Example 201. apache_get_modules() example<?php The above example will output something similar to: Array Code Examples / Notes » apache_get_moduleshazem 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; } ?> |