묻고답하기

에러내용 :
Fatal error: Cannot redeclare config_file() (previously declared in D:autoprojectlib.php:4) in D:autoprojectlib.php on line 4

해당함수는 이렇습니다
#config.php 에 기본내용 저장
function config_file($dbname,$hostname,$userid,$password){
        $str="<?n".$dbname."n".$hostname."n".$userid."n".$password."n?>";

        $configfile="./config.php";
        // 파일이 존재하는지 확인
        $flag=file_exists($configfile);
        # 만약에 존재하면 파일 접근 모드 확인
        if($flag){
        $permission=fileperms($configfile);
        #접근모드를 8진수형태로 변형
        $octal=DecOct($permission);
        #접근모드가 707 이 아니면 chmod() 수행
        if($octal!=100707){
                        $chmod=chmod($configfile,0707);
                        if(!$chmod){
                                echo "chmod() function Error";
                                exit;
                        }
                )
                #fileperms()함수를 수행하여 캐쉬에 남은 데이터를 삭제
                clearstatcache();

                global $data;
                 # 파일을 열고
                $fp=fopen($filename,r);
                # 내용을 읽어온후        
                $data=fread($fp,filesize($configfile));
                # PHP 행을 지우고..        
                $data = str_replace("<?","",$data);        
                $data = str_replace("?>","",$data);
                #문자열을 배열에 담는다..
                $data=explode("n",$data);

                return $data;

                }
        }
        #만약에 존재하지 않으면 파일 생성
        else{
                if(!touch($configfile)){
                        echo " file create Error";
                        exit;
                }

                #접근모드를 707 로 지정
                $chmod=chmod($configfile,0707);
                if(!$chmod){
                        echo "chmod() function Error";
                        exit;
                }
                $fp=fopen($configfile,"w");
                fputs($fp,$str);
                fclose($fp);
        }
}