tags:

views:

211

answers:

1

I am getting http500 for the code below,I am not sure what is wrong. I am new to php. I have checked that PDF.php is in the right directory and so does fonts

<?php
define('FPDF_FONTPATH','/home/php/File/PDF/fonts/');
require('/home/php/File/PDF.php');
$pdf=new FPDF('P', 'mm', array(100,150));
$pdf->AddPage();
$pdf->SetFont('times');
$pdf->Cell(40,10,'Hello World!');
$pdf->Output("ruchit.pdf", D);
?>
A: 

Just to be sure :

  • are your path corrects ?
    • do /home/php/File/PDF.php and /home/php/File/PDF/fonts/ really exist ?
    • If I download and install the last version of fpdf, I have : /.../fpdf16/fpdf.php and /.../fpdf16/font/
    • I have no "File" directory -- but I might not have the same install/version as you
  • on your last line of code, you should put quotes arround the 'D', to avoid this notice : Notice: Use of undefined constant D - assumed 'D'

Just after setting the right pathes for my system, and quoting the constant/string, "it works for me"...

... So, question : do you have any error, in Apache's log for example ?

Pascal MARTIN