Last active
August 29, 2015 14:11
-
-
Save lewisgoddard/acce162e2ce91bf31970 to your computer and use it in GitHub Desktop.
This file contains 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 | |
//// IS exec() enabled | |
// A simple `is` script to determine if | |
// exec() is enabled and working. | |
// | |
// Inputs: None; | |
// | |
// Outputs: | |
// - $Exec_Enabled | |
// true if enabled | |
// false if not | |
// | |
// MIT Licensed | |
if ( | |
// IF Function Exists | |
function_exists('exec') && | |
// AND NOT in the array of disabled functions | |
!in_array('exec', array_map('trim', explode(', ', ini_get('disable_functions')))) && | |
// AND NOT in safe mode | |
strtolower(ini_get('safe_mode')) != 1 && | |
// AND it actually works | |
// (this will generate a warning if it doesn't, but we tried to check) | |
exec('echo WORKING') == 'WORKING' | |
) { | |
// exec() is enalbed | |
$Exec_Enabled = true; | |
} else { | |
// exec() is NOT enalbed | |
$Exec_Enabled = false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment