I am trying to get the exec() function to file off a commad for pdftk and it is neither working and I cannot figure out how to capture the error if one is being thrown.
I tried:
$output = array();
$return_var = -1;
exec('pdftk RabiesVacCert.pdf fill_form vac.fdf output vaccine_cert.pdf flatten',$output,$return_var);
if ($return_var === 0) {
//Record the success
}else{
throw new \Exception(implode("\n", $output));
}
and:
$output = array();
$return_var = -1;
exec("pdftk /full/path/to/folder/where/class/is/RabiesVacCert.pdf fill_form /full/path/to/folder/where/class/is/vac.fdf output /full/path/to/folder/where/class/is/Shotsvaccine_cert.pdf flatten",$output,$return_var);
if ($return_var === 0) {
//Record success
}else{
throw new \Exception(implode("\n", $output));
}
and nothing is happening. Any ideas what I am doing wrong with exec() or how I can show the errors? Running on Ubuntu 14.04 and it works fine via command line on server.