2012-07-29 84 views
-2

我得到我的网页上这个错误安全方面的原因:警告:EXEC()已禁用

警告:EXEC()已因安全原因禁止在/ home/a2297145 /的public_html /安卓/指数.PHP上线2036

下面的代码:

// 
// Determine the size of a file 
// 
public static function getFileSize($file) 
{ 
    $sizeInBytes = filesize($file); 

    // If filesize() fails (with larger files), try to get the size from unix command line. 
    if (EncodeExplorer::getConfig("large_files") == true || !$sizeInBytes || $sizeInBytes < 0) { 
     $sizeInBytes=exec("ls -l '$file' | awk '{print $5}'"); 
    } 
    return $sizeInBytes; 
} 

你能帮我解决这个问题?

+6

您必须与您的主机提供商交谈......他们已禁用了exec命令的使用......请阅读警告信息;) – craig1231 2012-07-29 18:06:30

+2

获取具有64位PHP安装的提供程序,并且该函数将变得毫无意义。 – 2012-07-29 18:08:02

+3

Duplicate:http://stackoverflow.com/questions/1837451/exec-has-been-disabled-for-security-reasons-undefined-variable – 2012-07-29 18:08:57

回答

2

错误的含义正是它所说的。无论谁设置你的服务器(可能是你的虚拟主机)都禁止使用exec函数。换句话说,您不能使用exec

你可以通过使用glob来获取文件的文件或filesize来获得文件的大小(以字节为单位)来解决它。