Question

I'm using PDFTK to merge some PDFs on my Amazon EC2 instance running Windows Server and IIS7.

When I try running PDFTK using PHP exec(), it does not work. For example:

<?php
$e = exec("pdftk");
var_dump($e); //output is: string(0) ""
?>

I can get other commands to work using exec such as exec("ping 192.168.2.1") but I can't get PDFTK working.

I can also run pdftk from DOS command line, so I know it's installed properly.

I also set the permissions to pdftk.exe to full access for all users (thinking this was a permissions issue).

I remember having a similar problem when I installed PDFTK on another Windows Server Amazon EC2 instance, but I forgot exactly what I needed to change. I thought it had something to do with IIS_USR Permissions but it was a while back and I don't remember the specifics.

Thank you.

Was it helpful?

Solution

The application either needs to be in the same directory as the script, or within the $PATH environment variable for the user executing the PHP script. With IIS, this is not the user you are logged in with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top