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 3969390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:57:29+00:00 2026-05-20T03:57:29+00:00

I am trying to Fill in a PDF from PHP script. I am following

  • 0

I am trying to Fill in a PDF from PHP script. I am following the article by Sid Steward at the following URL.

I have configured PDFTk package on CentOS linux distribution and I am able to execute the pdftk from the command prompt and it merges the FDF form with the PDF and successfully generates the flattened(Filled) PDF. I am using following command to test the Pdftk using shell.

pdftk /tmp/form.pdf fill_form /tmp/fdfbm0pe7 output /tmp/filledform.pdf flatten

But When try to execute a similar command through PHP, I am getting the error. The passthru command is failing with error code 11. Following is the php code I am using to execute the command:

$command = 'pdftk form.pdf fill_form '. $fdf_fn. ' output - flatten';
passthru($command, $error);

The $fdf_fn above has the FDF file name. The form.pdf is the fill-able pdf form. Both the form.pdf and the PHP script file from which I have given the above lines of code are in the same folder. I have checked that PDFtk is executing correctly through PHP by echoing shell_exec(‘pdftk’) and it was returning the standard help details.

Just to provide more details, the path to pdftk is /usr/bin/ and PHP script and PDF form files are located under /var/www/html/pdfmerge.

Can some one please guide what I am doing wrong that the command execution through PHP is failing with error code 11?

  • 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-20T03:57:29+00:00Added an answer on May 20, 2026 at 3:57 am

    I had the exact same issue with PHP running PDFTK on CentOS and spent a number of hours hunting things down, so I hope someone will find this useful. My specific use for PDFTK is for the FillPDF module on Drupal. The solution to the exit code 11 issue was setting a local policy module to allow httpd to run PDFTK. If you grep /var/log/audit/audit.log for pdftk like this

    grep -i pdftk /var/log/audit/audit.log
    

    you should see some errors, probably one for ‘execmem’, amongst others. Here is what I did to fix the issue…

    Running this command will pull the errors out of the log and put them into a file for you to review.

    grep -i pdftk /var/log/audit/audit.log | audit2allow -m pdftklocal > pdftklocal.te
    

    If the output looks good (e.g. there IS output), run this command to create the module.

    grep -i pdftk /var/log/audit/audit.log | audit2allow -M pdftklocal
    

    Once the module is created, you make the policy active by running this command.

    /usr/sbin/semodule -i pdftklocal.pp
    

    PDFTK should run now from PHP. If it does not, check to see if httpd_enable_cgi is on by running

    getsebool httpd_enable_cgi
    

    If it is not on, turn it on by running

    setsebool -P httpd_enable_cgi 1
    

    Details on the policy module can be found here: http://wiki.centos.org/HowTos/SELinux#head-faa96b3fdd922004cdb988c1989e56191c257c01

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

Sidebar

Related Questions

I am trying to fill a form in a php application from a C#
Trying to fill the listbox programatically I have written the following code: protected override
I am trying to fill a javascript array beaches3 from a php request dynamically
I am trying to Fill a formula that I have in D1 and fill
I'm trying to fill an array of 20 ints with numbers from 1-20 in
I am trying to fill up my matrix with zeros. Unfortunatelly, in the following
I'm trying to load a existing pdf file, and fill this with database information.
I am trying to fill up an NSmutableAray with data from sqlite database. ItemShow
I'm trying to fill a grid view using data from a db cursor using
I have some classes and I'm trying to fill the objects of this class.

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.