Extra Form
PHP PHP 7.0
CMS XpressEngine

윈도우10에 Autoset (APM)을 설치하여 이것저것 테스트 해 보고있습니다.

 

스케치북 _read.html 에 php 파일을 인크루드 해야되는데요,

 

<!--#include("C:\AutoSet10\public_html\abc\aaa.php")-->

<!--#include("/abc/aaa.php")-->

<!--#include("/public_html/abc/aaa2.php")-->

<include target="/abc/exif2.php" />

<include target="C:\AutoSet10\public_html\abc\aaa.php" />

<include target="/public_html/abc/aaa.php" />

 

이렇게 몇가지 방법을 다 사용했는데도  aaa.php 문에 포함되어있는 함수호출이 되지 않고 화면만 깨지는 오류가 생깁니다.

 

똑 같은 파일을 리눅스호스팅 서버에서는 정상적으로 사용을 하고 있는건데 말이죠.

 

혹시 윈도우서버에서는 include 하는방법이 달라져야하나요?

 

aaa.php 파일은

<?

..................

?>

이렇게 구성되어있습니다

 

 

 

 

  • profile

    혹시 윈도우 문제가 아니라 <?php 를 <? 로 줄여써서 그런 것 아닐까요?
    최근에 PHP를 신규 설치하면 이 문법 안 먹힙니다.

    웹호스팅에서는 호환성 때문에 대충 봐주도록 설정해 놓을 뿐...

  • profile profile

    exif 출력과 관련된 코드인데 이렇습니다

     

    <?php
    
    // This function is used to determine the camera details for a specific image. It returns an array with the parameters.
    function cameraUsed($imagePath) {
    
        // Check if the variable is set and if the file itself exists before continuing
        if ((isset($imagePath)) and (file_exists($imagePath))) {
        
          // There are 2 arrays which contains the information we are after, so it's easier to state them both
          $exif_ifd0 = read_exif_data($imagePath ,'IFD0' ,0);       
          $exif_exif = read_exif_data($imagePath ,'EXIF' ,0);
      $exif_makernote = read_exif_data($imagePath ,'MAKERNOTE' ,'UndefinedTag');
    
    //MAKERNOTE.UndefinedTag:0x0095: EF24-70mm f/2.8L II USM   
    
          //error control
          $notFound = "-";
          
          // Makernote 
          if (@array_key_exists('UndefinedTag', $exif_makernote)) {
            $camMakenote = $exif_makernote['UndefinedTag'];
          } else { $exif_makernote = $notFound; }
    //$return['makernote'] = $camMakernote;
          // Make 
          if (@array_key_exists('Make', $exif_ifd0)) {
            $camMake = $exif_ifd0['Make'];
          } else { $camMake = $notFound; }
          
          // Model
          if (@array_key_exists('Model', $exif_ifd0)) {
            $camModel = $exif_ifd0['Model'];
          } else { $camModel = $notFound; }
          
          // Exposure
          if (@array_key_exists('ExposureTime', $exif_ifd0)) {
            $camExposure = $exif_ifd0['ExposureTime'];
          } else { $camExposure = $notFound; }
    
          // Aperture
          if (@array_key_exists('ApertureFNumber', $exif_ifd0['COMPUTED'])) {
            $camAperture = $exif_ifd0['COMPUTED']['ApertureFNumber'];
          } else { $camAperture = $notFound; }
          
          // Date //파일날자
          if (@array_key_exists('DateTime', $exif_ifd0)) {
            $camDate = $exif_ifd0['DateTime'];
          } else { $camDate = $notFound; }
    
          // Date2
          if (@array_key_exists('DateTimeOriginal', $exif_exif)) {
            $camDate2 = $exif_exif['DateTimeOriginal'];
          } else { $camDate2 = $notFound; }
    
          // ISO
          if (@array_key_exists('ISOSpeedRatings',$exif_exif)) {
            $camIso = $exif_exif['ISOSpeedRatings'];
          } else { $camIso = $notFound; }
    
    //Software
          if (@array_key_exists('Software', $exif_ifd0)) {
            $camSoft = $exif_ifd0['Software'];
          } else { $camSoft = $notFound; }
    
    //FocalLength
          if (@array_key_exists('FocalLength', $exif_ifd0)) {
            $camFocal = $exif_ifd0['FocalLength'];
          } else { $camFocal = $notFound; }
    
    
    //Height
          if (@array_key_exists('Height', $exif_ifd0['COMPUTED'])) {
      $camHeight = $exif_ifd0['COMPUTED']['Height'];
          } else { $camHeight = $notFound; }
    
    //Widht
          if (@array_key_exists('Width', $exif_ifd0['COMPUTED'])) {
      $camWidth = $exif_ifd0['COMPUTED']['Width'];
          } else { $camWidth = $notFound; }
    
          $return = array();
          $return['make'] = $camMake;
          $return['model'] = $camModel;
      $return['makernote'] = $camMakernote;
          $return['exposure'] = $camExposure;
          $return['aperture'] = $camAperture;
          //$return['date'] = $camDate; //파일날자
          $return['iso'] = $camIso;
      $return['soft'] = $camSoft;
      $return['focal'] = $camFocal;
      $return['height'] = $camHeight;
      $return['width'] = $camWidth;
      $return['date2'] = $camDate2;
          return $return;
    
        } else {
          return false; 
        } 
    }
    ?>

     

  • profile profile

    인클루드가 되는지 안 되는지 판단하는 데 있어서 해당 파일의 함수 내용은 중요하지 않습니다. 화면이 깨진다면 깨진 상태의 스크린샷이라도 보여주셔야지... 그냥 깨진다는 말만으로는 이게 파일 경로를 못 찾아서 인클루드가 안 되는 건지, 사용하시는 PHP 버전에 안 맞는 문법이 있어서 인클루드가 안 되는 건지, 아니면 실제 함수 내용에 문제가 있는 건지 알 수 없습니다.

    우선 경로 문제가 의심된다면
        <include target="../../../../abc/exif2.php" />
    이렇게 스케치북 스킨 폴더를 기준으로 하는 상대경로도 실험해 보세요.

    또 한 가지 가능성은... 윈도우 서버에 exif 확장모듈이 설치되어 있지 않아서 read_exif_data 부분에서 오류가 나고 있을지도 모릅니다. exif 확장모듈이 설치되어 있는지 "서버 환경 확인" 페이지 또는 phpinfo를 체크해 보세요. 장님 코끼리 다리 만지듯이 그냥 의심되는 것 아무거나 던져보는 중입니다.

  • profile profile
    힌트 주신 덕분에 해결했습니다.
    결국은 경로 문제였네요.
    <include target="../../../../abc/aaa.php" />
    이렇게 해결했습니다. 그런데 왜 리눅스서버랑 윈도우서버가 경로설정하는게 다를까요..거참
  • profile
    절대 경로 말고 상대경로로 입력하시고

    \ 가 아닌 / 로 바꿔보세요 : )
  • profile
    <!--#include("/abc/aaa.php")-->

    <!--#include("/abc/aaa.php")-->

    <!--#include("/abc/aaa2.php")-->

    <include target="/abc/exif2.php" />

    <include target="/abc/aaa.php" />
  • profile profile

    <include target="../../../../abc/aaa.php" />
    이런 상대경로표시로 성공했습니다.
    감사합니다.

  • profile ?
    include를 쓰면 파일을 못찾아도 에러없이 그냥 진행해버리기 때문에
    지금 경우처럼 헷갈리시는 경우가 있을 수 있겠지요.
    항상 포함된다면 웬만하면 require를 쓰시는게 더 나을겁니다.
    require 쓰셨으면 파일을 찾을 수 없다고 에러가 떴을거고..
    그럼 좀 더 빨리 해결이 가능했겠죠.
    include를 쓰면 그냥 조용히 경고만 뜨기 때문에... 아마 에러로그파일
    뒤져보시면 include가 남긴 파일 못찾는다는 경고가 남아있긴
    할거에요.
  • ? profile
    아, 그렇군요.
    말씀대로 오류메세지가 없어 시간이 많이 걸렸습니다.
    require 로도 테스트 해 보겠습니다.
    좋은 말씀 감사합니다 ^^