2

I am new so ssh and terminal commands I am installed pdftk on my web server (Linus Cent-Os dedicated virtual server) using the stack overflow.

Although got initially problems because all of my experience was GUI, but somehow following the instructions, I succeeded in installing pdftk

Now when I type command whereis pdftk

the response is

pdftk :/usr/bin/pdftk /usr/local/bin/pdftk/

when I was following the instructiion, the last step was to copy the folder to /usr/local/bin/ that went successful. now when I issue the command pdftk --version it runs successfully, returning the version info.

in my php, when I try to use this with

passthru('/usr/local/bin/pdftk --version')

nothis is displayed

can somebody guide me what Can I do?

Community
  • 1
  • 1
Zaffar Saffee
  • 6,167
  • 5
  • 39
  • 77
  • If pdftk writes the version data to STDERR instead of STDOUT, you won't see it - passthru doesn't capture stderr usually. Try doing a `pdftk --version 2>&1` to force stderr into stdout. – Marc B Mar 24 '12 at 04:21
  • by addin ' 2>&1 ' in php code returns sh: /usr/bin/pdftk: No such file or directory, all though i have told you the output of ' whereis pdftk ' – Zaffar Saffee Mar 24 '12 at 06:00
  • using powerpannel, i have seen that the file pdftk actually exists on the location – Zaffar Saffee Mar 24 '12 at 07:09
  • 1
    Well, if the exec call can't find it, then perhaps consider that powerpanel is lying. – Marc B Mar 24 '12 at 14:27
  • using whereis pdftk command, using power panel, going to the location step by step (cd /usr/local/bin/) evrything shws that pdftk is there.. – Zaffar Saffee Mar 24 '12 at 20:29
  • only passthru() is not workng – Zaffar Saffee Mar 24 '12 at 20:29

2 Answers2

1

does it work when you leave out local and just do:

<?php echo passthru('/usr/bin/pdftk --version'); ?>

tried it on my server, /usr/bin/ does display version data but /user/local/bin doesnt

WebChemist
  • 4,393
  • 6
  • 28
  • 37
0

I had to set

safe_mode = Off

in /etc/php5/cli/php.ini, otherwise I only got

sh: /pdftk: No such file or directory.