Title: thecodery's Replies | WordPress.org

---

# thecodery

  [  ](https://wordpress.org/support/users/thecodery/)

 *   [Profile](https://wordpress.org/support/users/thecodery/)
 *   [Topics Started](https://wordpress.org/support/users/thecodery/topics/)
 *   [Replies Created](https://wordpress.org/support/users/thecodery/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/thecodery/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/thecodery/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/thecodery/engagements/)
 *   [Favorites](https://wordpress.org/support/users/thecodery/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Formidable PRO2PDF] Cannot map to PDF form fields](https://wordpress.org/support/topic/cannot-map-to-pdf-form-fields/)
 *  Thread Starter [thecodery](https://wordpress.org/support/users/thecodery/)
 * (@thecodery)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/cannot-map-to-pdf-form-fields/#post-6361559)
 * This issue with MAMP and shell_exec is quite common:
    Other possible solutions
   are: [http://stackoverflow.com/questions/10640045/php-shell-exec-only-works-for-certain-commands](http://stackoverflow.com/questions/10640045/php-shell-exec-only-works-for-certain-commands)
   [http://stackoverflow.com/questions/11036895/why-cant-i-execute-ffmpeg-using-shell-exec-in-a-mamp-environment](http://stackoverflow.com/questions/11036895/why-cant-i-execute-ffmpeg-using-shell-exec-in-a-mamp-environment)
   [http://stackoverflow.com/questions/7163497/resolved-mamp-php-cant-exec-convert-after-homebrew-imagemagick-install](http://stackoverflow.com/questions/7163497/resolved-mamp-php-cant-exec-convert-after-homebrew-imagemagick-install)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Formidable PRO2PDF] Cannot map to PDF form fields](https://wordpress.org/support/topic/cannot-map-to-pdf-form-fields/)
 *  Thread Starter [thecodery](https://wordpress.org/support/users/thecodery/)
 * (@thecodery)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/cannot-map-to-pdf-form-fields/#post-6361557)
 * Unfortunately I don’t think this is the solution. I’m running PHP 5.6
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Formidable PRO2PDF] Cannot map to PDF form fields](https://wordpress.org/support/topic/cannot-map-to-pdf-form-fields/)
 *  Thread Starter [thecodery](https://wordpress.org/support/users/thecodery/)
 * (@thecodery)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/cannot-map-to-pdf-form-fields/#post-6361510)
 * Got 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.

Viewing 3 replies - 1 through 3 (of 3 total)