我创建了一个监视Network IP
或Server Status
的应用程序。它适用于windows xampp server
并且还在linux centos 6.0
上进行了测试。两者都运作良好。但是,当我将脚本上传到安装了cpanel的网站时,我的脚本不在那里工作。那是一个linux托管服务器
我的Windows Ping命令:
$exec = exec( "ping www.google.com -n 3 ". $output, $status );
我对Centos的Ping命令:
$exec = exec( "ping www.google.com -c 3 ". $output, $status );
$output
和$status
变量都返回准确值。但在cpanel中,$output
为空,$status
变量返回2而不是0或1
需要帮助谢谢,
检查您的主机提供商是否允许使用此功能,如果是,所以尝试使用这样的exec:
$exec = exec( "ping www.google.com -c 3 ", $output, $status );
如果它不工作你可以尝试另一个像exec的PHP函数:
system('ping www.google.com -c 3 ', $output);
你可以使用nagios来监控并在nagios上构建你的应用程序
function disabled_functions(){
$disabled = explode(',', ini_get('disable_functions'));
return $disabled;
}
echo '<pre>';
print_r(disabled_functions());