PHP / Perl文件大小功能在新服务器上不起作用

| 我的功能无法正常运行,因为我将站点从共享主机移到了VPS(两个操作系统都具有相同的Linux OS,php版本5.2.9和Perl版本5.8.8),我遇到了问题。 当我的脚本将远程文件存储到本地目录时,我使用XMLHttpRequest以固定的间隔(5秒)运行一个简单的php脚本,该php脚本执行一个Perl脚本,该脚本返回当前文件的大小(已下载的字节数)。 这是PHP代码:
<?php
if (isset($_GET[\'file\'])) {
    clearstatcache();
    $file = $_GET[\'file\'];
    exec(\"/usr/bin/perl /home/xxxxxx/public_html/cgi-bin/filesize.pl $file\", $output);
    //print_r($output);
    if (!empty($output) || $output[0] != \"\") {
        $currentSize = $output[0];
        file_put_contents(\'progress.txt\', $currentSize);
    } else {
        ...
        ...
    }
}
?>
这是Perl代码
#!/usr/bin/perl
$filename = $ARGV[0];
$filepath = \'/home/xxxxxx/public_html/tmp_dir/\'.$filename.\'.flv\';
$filesize = -s $filepath;
print $filesize;
当我在共享服务器上运行这些脚本时,我没有问题,可以看到下载进度,但是现在,只有在完全下载了远程文件并且看不到进度时才打印文件大小。 我想我需要更改php设置中的某些内容,但我不确定,我也不知道需要更改什么。 好的,对不起/愚蠢,filesize()函数可以正常工作,谢谢大家。     
已邀请:
如果需要文件大小,也可以从PHP调用the2ѭ函数,而不必完全使用perl。     
该问题可能是由其他文件位置引起的。您确定文件“ 3”存在吗?您可以使用以下方法进行测试:
if (-e \'/home/xxxxxx/public_html/tmp_dir/\'.$filename.\'.flv\')
请记住,您可以改用PHP
filesize()
<?php
if (isset($_GET[\'file\'])) {
    clearstatcache();
    $file = $_GET[\'file\'];
    if (file_exists(\"/home/xxxxxx/public_html/tmp_dir/$file.flv\") {
        $currentSize = filesize(\"/home/xxxxxx/public_html/tmp_dir/$file.flv\");
        file_put_contents(\'progress.txt\', $currentSize);
    } else {
        ...
        ...
    }
}
?>
    

要回复问题请先登录注册