2011-07-26 40 views
0

我正在寫一個程序,填寫一個pdf模板(使用fpdf),然後捕獲截圖預覽給用戶。試圖寫一個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文本文件,所以我不知道如何調試這個谷歌顯示服務器錯誤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'); 

回答

0

雙重檢查與託管IT。

此類消息正在發生,因爲更改爲高於755的任何權限級別已在根級別禁用。

謝謝你的耐心等待。

相關問題