PDFTK cannot be run by www-data

I need to use PDFTK. It works when I use it in terminal as root, but when I try to use it with www-data I'm consistently getting a permission error.

When switching to www-data:

sudo -u www-data sh

and executing:

fpdtk simply.pdf generate_fdf output fields.fdf

I get this output:

Error: Unable to find file.
Error: Failed to open PDF file:
simply.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.

It seems the issue is that permission is denied for www-data user.

How can I change this?

2

2 Answers

This article saved my life! I has the same error using the pdftk snap.

Simply create a symlink with this command:

sudo ln -s /snap/pdftk/current/usr/bin/pdftk /usr/bin/pdftk

The issue was that the current folder was not owned by www-data. So be sure that the the owner is the same as the apache user(www-data or daemon)

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like