I recently installed pdftk using instruction provided at stack overflow
I installed it, and run the commanded whereis pdftk
the result was
/usr/local/bin/pdftk /usr/bin/pdftk
I have the powerpannel access and I saw it through it that pdftk actually exists at the location
i run the command pdftk --version
, it was okay
but when in php i use
<?php
$command = "pdftk --help";
system("PATH=/usr/local/bin/ && $command",$response);
if ($response===FALSE){
echo 'sorry error occured';
}
else{
echo $response;
}
?>
the output is 127 the version i am using is 1.41 and the output '127' is something that i cant understand
can somebody guide me?
edit
Actually, i was trying to generate dynamic pdf by filling a pdf form, my passthru was
passthru("/usr/local/bin/pdftk hud3.pdf fill_form result.pdf output - flatten");
this was returning nothing
although header before the statement pops up for download, and I press save button to save it on local, it was not saving it on my hard drive. trying to debug the situation, and getting help from already asked question on sktack overflow, i thought to run pdftk first. that's where the above 127 situation rised, need guideline
&&
(I think the command right to the&&
gets called in a subshell and this won't have the env.-var). Just usesystem("PATH=/usr/local/bin/ $command",$response);
or call it the way cjc did suggest (system("PATH=/usr/local/bin/$command",$response);
).hud3.pdf
andresult.pdf
located? In the same directory as the PHP file?safe_mode
set? If yes, is/usr/local/bin/
in thesafe_mode_exec_dir
? According to the PHP passthru doc you should, in case PHPsafe_mode
is on.