I successfully installed pdftk on a VPS. It works fine when I run the commands in command line, but when I run the script on php it does not generate the pdf file. No errors anything. Has anyone had this same issue? When the script is run on php the fdf file is generated but not the pdf.
Here is the code sample i am using.
$fName = 'Ryan';
$lName = 'Kempt';
$dateNow = date('F jS, Y');
$fdf = '%FDF-1.2
1 0 obj<</FDF<< /Fields[
<</T(first_name)/V('.$fName.')>>
<</T(last_name)/V('.$lName.')>>
<</T(date)/V('.$dateNow.')>>
] >> >>
endobj
trailer
<</Root 1 0 R>>
%%EOF';
file_put_contents('test.fdf', $fdf);
$out = '';
exec("pdftk test.pdf fill_form test.fdf output filled.pdf flatten", "2>&1", $out);
when I run pdftk test.pdf fill_form test.fdf output filled.pdf flatten on the terminal the pdf file was generated.
after adding 2>&1 I get error Fatal error: Only variables can be passed by reference