thecodery
Forum Replies Created
-
Forum: Plugins
In reply to: [Formidable PRO2PDF] Cannot map to PDF form fieldsThis issue with MAMP and shell_exec is quite common:
Other possible solutions are:
https://stackoverflow.com/questions/10640045/php-shell-exec-only-works-for-certain-commands
https://stackoverflow.com/questions/11036895/why-cant-i-execute-ffmpeg-using-shell-exec-in-a-mamp-environment
https://stackoverflow.com/questions/7163497/resolved-mamp-php-cant-exec-convert-after-homebrew-imagemagick-installForum: Plugins
In reply to: [Formidable PRO2PDF] Cannot map to PDF form fieldsUnfortunately I don’t think this is the solution. I’m running PHP 5.6
Forum: Plugins
In reply to: [Formidable PRO2PDF] Cannot map to PDF form fieldsGot bit closer with this.
The first problem is that I’m on MAMP which is looking in
/usr/bin/pdftk
but pdftk puts the link in/usr/bin/local/pdftk
. Consequently,@shell_exec("which pdftk")
returned NULL.I resolved that by creating a symlink:
sudo ln -s /usr/local/bin/pdftk /usr/bin/pdftk
However, the plugin still couldn’t find any fields in the uploaded PDF. Looking at the AJAX call I could see:
error2: "PDFTK returned no fields.",
I traced that down to
$fields_data = shell_exec("pdftk '$file' dump_data_fields_utf8 2> /dev/null");
which was returning NULL. Executing the same command in terminal (with the $file variable resolved to the correct file path) worked fine. So did the following in PHP:@shell_exec("/usr/local/bin/pdftk '$file' dump_data_fields_utf8 2> /dev/null");
However, executing the following through terminal:
/usr/bin/pdftk '... absolute path to file ...' dump_data_fields_utf8 2> /dev/null
returns:
Trace/BPT trap: 5
so it would seen that the symlink isn’t executing. Consequently, neither is the PHP call (which is using the symlink).
That’s as far as I’ve got at the moment.