php how to check if system commands are available for use?
How do i check if system commands like exec() , popen() , etc are ava开发者_StackOverflow社区ilable to use ?
Something like this :
<?php
function($cmd)
{
if($cmd available)
{
//do nothing
}
else
{
exit();
}
}
?>
And check if the php file has access to a command eg. If safe mode is on it should return false.
Have a look at function_exists()
If safe mode is on, all system commands like system(), exec(), passthru(), shell_exec(), popen()
, etc are not available. So, you can exit immediately in that case.
If it is off, you can check if command-execution functions are available with e. g. function_exists('exec')
精彩评论