Skip to content

Instantly share code, notes, and snippets.

@Shagshag
Created June 24, 2013 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shagshag/5849077 to your computer and use it in GitHub Desktop.
Save Shagshag/5849077 to your computer and use it in GitHub Desktop.
return true if the module $name is activated in apache
<?php
/**
* return true if the module $name is activated in apache
*
* @param string $name module name
* @return boolean
* @author Samdha
**/
function detect_apache_mod($name) {
$save = ob_get_clean();
ob_start();
phpinfo();
$phpinfo = ob_get_clean();
if ($save !== false) {
ob_start();
echo $save;
}
return (strpos($phpinfo, $name) !== false);
}
if (detect_apache_mod('mod_evasive')) sleep(1);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment