解决方案 »

  1.   

    1、服务器不支持这种压缩格式,可使用function_exists('ob_gzhandler')判断,解决方法 ob_start('ob_gzhandler')改为ob_start();2、使用ob_start('ob_gzhandler')时候前面已经有内容输出,检查前面内容以及require include调用文件的内容。若无法找到可以在调用其它文件前使用ob_start(),调用之后使用 ob_end_clean () 来清除输出的内容;
    我出现的这个错误,就是由于在ob_start之前有输出内容的了。所以才导致程序运行不起来。
      

  2.   

    代码文件中是否有BOM头?  这种先行输出的问题在windows服务器下如果简单的改动了代码会有类似的问题.附上去除bom头的文件一份. 希望能帮到你.<?php
    if (isset($_GET['dir'])){ //设置文件目录
    $basedir=$_GET['dir'];
    }else{
    $basedir = '.';
    }
    $auto = 1;
    checkdir($basedir);
    function checkdir($basedir){
    if ($dh = opendir($basedir)) {
      while (($file = readdir($dh)) !== false) {
       if ($file != '.' && $file != '..'){
        if (!is_dir($basedir."/".$file)) {
         echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>";
        }else{
         $dirname = $basedir."/".$file;
         checkdir($dirname);
        }
       }
      }
    closedir($dh);
    }
    }
    function checkBOM ($filename) {
    global $auto;
    $contents = file_get_contents($filename);
    $charset[1] = substr($contents, 0, 1);
    $charset[2] = substr($contents, 1, 1);
    $charset[3] = substr($contents, 2, 1);
    if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {
      if ($auto == 1) {
       $rest = substr($contents, 3);
       rewrite ($filename, $rest);
       return ("<font color=red>BOM found, automatically removed.</font>");
      } else {
       return ("<font color=red>BOM found.</font>");
      }
    }
    else return ("BOM Not Found.");
    }
    function rewrite ($filename, $data) {
    $filenum = fopen($filename, "w");
    flock($filenum, LOCK_EX);
    fwrite($filenum, $data);
    fclose($filenum);
    }
    ?>
      

  3.   

    把文件保存成一个php文件 放到网站的根路径下,  执行一次  看屏幕输出, 如果有BOM头输出 会有红色的字提示, 然后再试试.