认清事物的本质-简单

博客园 首页 新随笔 联系 订阅 管理

这个问题的解决,关键还在于查看调试信息的错误提示。

官方给出出现该问题的一般原因:

1 gd库未安装(具体怎么办,网上很多);

这里给出一段代码

<?php
phpinfo();

if(extension_loaded('gd')) {
 echo'你可以使用gd&lt;br>';
foreach(gd_info() as$cate=>$value)
echo$cate.': '.$value.'<br>';
}else
echo'你没有安装gd扩展';

?>
把这段代码保存为php文件,然后通过websever执行以下,看看最下方的结果就可以了。
2 BOM编码问题
这里同样有一段代码,有心人写的,这里借用以下
<?php
//remove the utf-8 boms
//by magicbug at gmail dot com

if (isset($_GET['dir'])){ //config the basedir
    $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);
}
?>
这段代码执行一下(别说不会执行,懂点php的都应该看得懂),会把相应目录底下的文件都检查一遍
3 这是我遇到的问题,提示信息主要为 session_start() Permission denied
其实就是session的权限问题,解决这个所要做的:
     1检查php.ini 文件中 session.save_path = "设置一个有效文件夹的绝对路径" ,不要注释掉,并且目录正确,一般为C:\WINDOWS\temp
     2 将上一步设置的目录的用户权限改为everyone,可以读写(这一步很重要)
基本上就这些问题,以后遇到了再添加。
posted on 2011-06-30 13:23  萧冲  阅读(906)  评论(0编辑  收藏  举报