Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6214793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:56:26+00:00 2026-05-24T06:56:26+00:00

I’m writing a program that fills in a pdf template (using fpdf) then captures

  • 0

I’m writing a program that fills in a pdf template (using fpdf) then captures a screenshot to preview to the user.

Imagemagick seems to need a existing file in the filesystem to capture the preview image meaning I need to save the pdf to directory.

I followed the directions (found here: Cannot Save File to directory using FPDF) to change permission on the folder to enable me to write to the directory but whenever I run my php page now I get:

I have 755 as the default permission, and since I’m just testing and this folder isn’t particularly mission critical I tried to change to 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

I checked the folder after that error and permission reverts back to 755 and there is not a error_log text file so I’m not sure how to debug this as google reveals server error 500 is a generic catch all.

The hosting service is bluehost.com

Here is the code:

<?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');

The above code works as expected when the permission is on 755 and when the last line is changed to download instead of file save ie:

$pdf->Output(); //OR
$pdf->Output('testdocument.pdf', 'D');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:56:26+00:00Added an answer on May 24, 2026 at 6:56 am

    Double checked with Hosting IT.

    Such message are happening because changing to any permission level higher than 755 has been disabled at the root level.

    Thank you for your patience.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.