_common.php 경로 관련해서 계속 오류가 발생합니다.

_common.php 경로 관련해서 계속 오류가 발생합니다.

QA

_common.php 경로 관련해서 계속 오류가 발생합니다.

본문

우선 폴더 구조가

root/ new/ category / 해당 파일.php 이렇게 존재하고 있습니다.

그런데 _common.php 파일을 불러오려고 

<?
include_once("../../_common.php");
?>

이렇게 선언해주면 다음과 같은 에러가 발생합니다.

Warning: main(../../_common.php) [function.main]: failed to open stream: No such file or directory in/home/dnew29/public_html/new/category_07/category_0705.php on line 2

Warning: main() [function.include]: Failed opening '../../_common.php' for inclusion (include_path='.:/usr/lib/php/pear') in /home/dnew29/public_html/new/category_07/category_0705.php on line2

불러오려는 _common.php 파일은 그누보드 루트쪽에 있는 파일인데...왜 에러가 계속 발생하는지 모르겠습니다.

* root 디렉토리에는 _common.php와 common.php가 존재하고 있습니다.

* $_SERVER['DOCUMENT_ROOT']를 통해 파일을 불러오면 다음과 같은 에러가 발생했습니다.

Warning: main(./common.php) [function.main]: failed to open stream: No such file or directory in /home/dnew29/public_html/_common.php on line 3

Warning: main() [function.include]: Failed opening './common.php' for inclusion (include_path='.:/usr/lib/php/pear') in /home/dnew29/public_html/_common.php on line 3

_common.php 파일의 경로가 문제인가요? 아님 제가 파일에서 선언을 따로 해줘야 되는 게 있는 걸까요?

<?
include_once("../../_common.php");

?>
<?


// 선택옵션으로 인해 셀합치기가 가변적으로 변함
$colspan = 5;

//if ($is_category) $colspan++;
if ($is_checkbox) $colspan++;
if ($is_good) $colspan++;
if ($is_nogood) $colspan++;

// 제목이 두줄로 표시되는 경우 이 코드를 사용해 보세요.
// <nobr style='display:block; overflow:hidden; width:000px;'>제목</nobr>
?>
<style>

.calendarT table,td { font-family : dotum ; font-size : 9pt; }
.hand { cursor:hand; }
</style>
<?php
 

	if(!$ndate) {
		$ndate = date("Y-m");
	}

	$ntime = strtotime($ndate);
	$curY=date("Y", $ntime);
	$curM=date("m", $ntime);

	if($curY == date("Y") && $curM == date("m")) {
		$curD = date("d");
	}

    if ($curM =="") 
    { 
    
        $tmpDate = getdate(); 
        $curM = $tmpDate[mon]; 
        $curD = $tmpDate[mday]; 
        
    } 
    
    if($curY ==''){
    	$curY = $tmpDate[year];
    } 
    
    $preM = $curM - 1; 
    $nextM = $curM + 1; 
    $preY = $curY; 
    $nextY = $curY; 
     
    if ($curM==1) 
    { 
        $preM = 12; 
        $preY = $curY - 1; 
    } 
    elseif($curM==12) 
    { 
        $nextM = 1; 
        $nextY = $curY + 1; 
    } 
         
    $preDate = mktime(0,0,0,$preM, 1,$preY); 
    $curDate = mktime(0,0,0,$curM, 1,$curY); 
    $nextDate = mktime(0,0,0,$nextM, 1,$nextY); 

    $preMaxday = date(t,$preDate); 
    $curMaxday = date(t,$curDate); 
    $nextMaxday = date(t,$nextDate); 

    $preFw = date(w,$preDate);   
    $curFw = date(w,$curDate);   
    $nextFw = date(w,$nextDate);   

    $preJu = floor(($preMaxday+$preFw)/7)+1 ;     // 
    $curJu =floor(($curMaxday+$curFw)/7)+1 ;     // 
    $nextJu = floor(($nextMaxday+$nextFw)/7)+1 ;     // 
    $yoil = array('','SUN','MON','TUE','WED','THU','FRI','SAT');  
    $month = array('','January','February','May','April','March','June','July','August','September','October','November','December'); 
     

    
    
    //메인테이블 시작 
    $cur = 0; 
    echo "<div align=left style='padding-top:10px;'>";


?>
<table width='760' cellspacing='0' cellpadding='0' style="padding-left:1px;">
  <tr><td colspan="5" height="30"></td></tr>
  <tr>
    <td width='124' align='left' class='a2'>
		<?
		echo date("Y.m",strtotime("-1 month", $ntime)); 
		?>
	</td>
    <td width='39' align='left'><a href="?f_submenus=<?=$f_submenus?>&ndate=<?=date("Y-m",strtotime("-1 month", $ntime))?>"><img src='../images/left.gif' /><a/></td>
    <td width='' align='center' class='a1'>
	<?
		echo date("Y.m",$ntime);
	?>
	</td>
    <td width='39' align='right'><a href="?f_submenus=<?=$f_submenus?>&ndate=<?=date( "Y-m", strtotime("+20 day", mktime( 0, 0, 0, date("m",$ntime), 20, date("Y",$ntime)))  )?>"><img src='../images/rig.gif'/></a></td>
    <td width='124' align='right' class='a2'>
		<?
		echo date( "Y.m", strtotime("+20 day", mktime( 0, 0, 0, date("m",$ntime), 20, date("Y",$ntime)))  );
		?>
	</td>
  </tr>
  <tr>
    <td colspan='5' align='center'><img src='../images/d_day.png' /></td>
  </tr>
</table>	
<?

    echo "<table width='760' border='0' cellpadding='5' cellspacing='0' class='bg coun_cal'>"; 

    for($row = 0;$row<$curJu;$row++) 
    { 
        
            
            echo "<tr bgcolor='#FFFFFF'>";    
             
            for($col = 0;$col<=6;$col++)   
            {   $reserve_info="";              
                   
                    $cur++;   
                    if (($cur<=$curFw) || ($cur > ($curMaxday+$curFw)) == true) 
                    {                         
                        echo "<td width='106' height='98' align='right' valign='top' bgcolor='#fff9f6'> ";     
                    }else{ 
                        $day_fnc = $cur-$curFw;
                         

						if ($col==0) $colc="class='a4'";
						else if ($col==6) $colc="class='a3'";
						else $colc="";



                        echo "<td width='106' height='98' align='right' valign='top' bgcolor='#fff9f6' ".$colc.">"; 
                         

                        if (($cur-$curFw)==$curD)//오늘일자 하이라이트. 
                        {
							echo "<p class='today_cal'>".($cur-$curFw)."</p>";
						} else {
							echo $cur-$curFw;     
						}
                        
                                   

                        $sTime = mktime(0,0,0,$curM , $day_fnc , $curY );
                        $tTime = mktime(0,0,0,date("m") , date("d") , date("Y") );
                        $eTime = mktime(0,0,0,$curM , $day_fnc , $curY ) + 86390;

						$rdate = date("Y-m-d", $sTime);

						if (time() < $sTime && $col > 0 ) {
						?><div style="width:88px;padding-top:15px;text-align:center;color:#0000ff;">
								<a href='../../bbs/write.php?bo_table=reserve&rdate=<?=$rdate?>&f_submenus=0705'><img src='../images/a1.gif'/></a>
							</div><?
						} else {
						?>
						<div style="width:88px;padding-top:15px;text-align:center;color:#0000ff;">
						
						</div>
						<?
						}




						
						

                    } 
                 
                echo "</td>"; 
            } 
            echo "</tr>"; 
         
    } 

    echo "</table></div><br><Br>"; 

?> 
					
			<table width="760" cellspacing='0' cellpadding='0'>
				<tr>
					<td align="center">
							<a href="./sub.php?f_submenus=0705"><img src="../images/btn_resv01.jpg"/></a>
							<?
							if (!$member['mb_id']) {
							?>
									
							<?
							} else {
							?>
								<a href="../../bbs/board.php?bo_table=reserve&f_submenus=0705_1"><img src="../images/btn_resv03.jpg"/></a>
							<?
							}
							?>

							<?
							if (!$member['mb_id']) {
							?>
									<a href="./sub.php?f_submenus=0705_2"><img src="../images/btn_resv02.jpg"/></a>
							<?
							} else {
							?>
							
							<?
							}
							?>
							
                 
					</td>
				</tr>
				<tr>
					<td height="20"></td>
				</tr>
				</table>				
<style type="text/css">
.a1 {
	color: #f26122;
	font-size: 33px;
	font-weight: bold;
	font-family: Verdana, Geneva, sans-serif;
}
.a2 {
	color: #999;
	font-size: 20px;
	font-family: Verdana, Geneva, sans-serif;
}
.bg {
	color: #000;
	background-color: #fff9f6;
	font-weight: bold;
}
.a3 {
	color: #5180ad;
}
.a4 {
	color: #ca111a;
}

.coun_cal {border-left:1px solid #aaa; margin-left:2px;}
.coun_cal td {border-bottom:1px solid #ccc; border-right:1px solid #ccc;}
.today_cal {background:#f26122; color:#fff; padding:2px 4px; display:inline;}


</style>
					
				
					
					





					
					

이 질문에 댓글 쓰기 :

답변 2

include 문제입니다 ^^...
 
Warning: main(../../_common.php) [function.main]: failed to open stream: No such file or directory in/home/dnew29/public_html/new/category_07/category_0705.php on line 2

Warning: main() [function.include]: Failed opening '../../_common.php' for inclusion (include_path='.:/usr/lib/php/pear') in /home/dnew29/public_html/new/category_07/category_0705.php on line2
 
스트림 오픈 실패, 파일이나 디렉토리 찾을 수 없다는 뜻인데...
지금 살펴보면... 현재 위치 기준에서  이전 디렉토리/이전디렉토리/_common.php 로 작동하게 되겟죠...
 
지금 디렉토리 상태를 보면 /home/dnew29/public_html/new/catgory_07/category_0705.php
로 되어있는데... 여기서 include 를 하게 되면... 전 전 디렉토리는 new 디렉토리가 되기 때문일 껍니다...
제가 예상하기로는 new 디렉토리에 _common.php 파일이 없기 때문인데요....
 
또한 include 하는 _common.php 파일은 common.php 파일을 간접적으로 참조하는 파일입니다.
안에 내용을 살펴보면 다음과 같이 되어있겠죠..
 
<?
$g4_path="..";
include_once($g4_path/"_common.php");
?>
 
이런식으로 root 에 있는 _common.php 파일을 참조하게 되고 따라가게 되겟지만서도... 일단 질문자님이 혼란스러우시면...
 
현재 category_0705.php  이 있는 디렉토리의 위치에 _common.php 파일을 생성하십시오..
그리고 만들어진 _common.php 파일의 내부에 있는 $g4_path 변수를 잘 수정해주시고,
인클루드 하면 됩니다..
 
category_0705.php  에서 include_once("./_common.php"); 를 포함하시면 되겟습니다.
 
p.s 이와 같이 설정해도 작동하지 않는 경우, 파일의 Permision 문제일 수 있습니다.
혹시 작업하고 있는 계정이 root 계정인지, 일반 사용자 계정인지 확인하십시오.
 
root 계정으로 _common.php 파일을 생성해버리면 제대로 작동하지 않습니다.
답변을 작성하시기 전에 로그인 해주세요.
전체 55
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT