나는 fpdf를 사용하여 pdf 템플릿을 채우고 사용자에게 미리보기 화면을 캡처하는 프로그램을 작성하고 있습니다.파일 디렉토리에 pdf 쓰기 : 내부 서버 오류 얻기 500
Imagemagick은 PDF 파일을 디렉토리에 저장해야한다는 미리보기 이미지를 캡처하기 위해 파일 시스템에 기존 파일이 필요합니다.
나는 방향을 따라 (여기 : Cannot Save File to directory using FPDF)을 디렉토리에 쓸 나를 수 있도록 폴더에 대한 권한을 변경하지만 난 지금 내 PHP 페이지를 실행 할 때마다 내가 얻을 :내가 기본 권한으로 755이 그리고 난 그냥 테스트하고 있는데이 폴더는 내가 777
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.
URL: *Full URL*
Dangerously writable: [*File path on server*]
FIXED
내가 그 오류가 발생한 후 폴더를 확인하고 권한을 755로 다시 되돌아으로 변경하려 특히 미션 크리티컬하지와의 error_log이 아니므로 텍스트 파일 그래서 Google은 서버 오류 500을 드러내는 방법을 디버깅하는 방법을 잘 모릅니다.
호스팅 서비스는 여기에
코드입니다 bluehost.com입니다 :<?php
// Library imports
require_once(dirname(__FILE__)."/lib/fpdf/fpdf.php");
require_once(dirname(__FILE__)."/lib/fpdi/fpdi.php");
// End of imports
//OpenCnxn
mysql_connect(*the approrpiate stuff*) or die(mysql_error());
mysql_select_db(*the appropriate stuff*) or die(mysql_error());
//Query DB and calculate number of rows
$query = "Select ProfilePicture from Users where UserID = 1";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
$filename = "template.pdf";
$pdf = new FPDI();
$pdf->AddPage();
// import the template PFD
$pdf->setSourceFile($filename);
// select the first page
$tplIdx = $pdf->importPage(1);
// use the page we imported
$pdf->useTemplate($tplIdx);
//Image insertion
for($i=0;$i<$num_results;$i++){
$row = mysql_fetch_array($result);
$pdf->Image(htmlspecialchars(stripslashes($row['ProfilePicture'])), 13, 13, 35, 25);
}
$pdf->Output('testdocument.pdf', 'F');
위의 코드가 권한이 755에 때 예상 작품으로 마지막 줄은 대신 다운로드 변경 될 때 파일 저장 예 :
$pdf->Output(); //OR
$pdf->Output('testdocument.pdf', 'D');