开发者

php how to check if system commands are available for use?

开发者 https://www.devze.com 2023-03-20 20:11 出处:网络
How do i check if system commands like exec() , popen() , etc are ava开发者_StackOverflow社区ilable to 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

精彩评论

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