Created
February 15, 2016 10:26
-
-
Save onubadev/1629f944f1f055504f85 to your computer and use it in GitHub Desktop.
Check Apache modules availability in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Set the modules to check here | |
| $modulesList = array( | |
| 'mod_rewrite', | |
| 'mod_mime', | |
| 'mod_expires', | |
| 'mod_deflate', | |
| 'mod_headers' | |
| ); | |
| //Detection | |
| $result = null; | |
| if(function_exists('apache_get_modules') ){ | |
| foreach ($modulesList as $module) { | |
| $result .= "$module: " . (in_array($module, apache_get_modules()) ? 'Available' : 'Not Available') . '<br>'; | |
| } | |
| } else { | |
| foreach ($modulesList as $module) { | |
| $result.= "$module: " . (strpos(shell_exec('/usr/local/apache/bin/apachectl -l'), $module) !== false ? 'Available' : 'Not Available') . '<br>'; | |
| } | |
| } | |
| ?> | |
| <!doctype html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Check apache modules</title></head> | |
| <body> | |
| <?php echo $result ?> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment