开发者

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')

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜