0

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); ?> 
3
  • what should i do to post the code in correct formating Commented Dec 5, 2009 at 21:38
  • 1
    A 500 error is mostly not caused by PHP code, it is a server error code. You should check the web server's error log files for details. Commented Dec 5, 2009 at 21:42
  • Turn on error reporting with php.net/manual/en/function.error-reporting.php to see them when the script runs. Commented Dec 5, 2009 at 21:50

2 Answers 2

1

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 ?

Sign up to request clarification or add additional context in comments.

Comments

0

This is the challenging of all but I try more than what you are saying but not; I want to suggest to all programmer this fpdf error causes by your own currently made a mistake and loosing program itself. Therefore cross check all the code what you write and fix it that is the solution. Either browser or generating a copy file does not have give a solution. I respect all ; I fix I am not doing fpdf type program on my page.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.