0

I'm running a website on a linux server and I'm trying to install pdfinfo (part of the xpdf package) in the terminal. I'm logged in to the SSH shell and I've unpacked the .tar file. Inside of it is the pdfinfo executable, however I can't seem to do anything with it or test whether it works or not. I need to have it installed so that I can call upon in from php to give me the dimensions of a pdf (a la PHP Get height and width in Pdf file proprieties)

I've been able to install pdfinfo locally on my windows machine running WAMP however I haven't been able to get it to work on the server.

Please really dumb it down and phrase your answer as if you're speaking to a child. I'm really out of my wheelhouse with this...

Community
  • 1
  • 1
tomc
  • 417
  • 5
  • 17
  • Do you have root on the server? – Kenney Nov 03 '15 at 20:11
  • Yeah, I think so. Assuming you're asking if I have access to the root folders – tomc Nov 03 '15 at 20:12
  • No, I meant, does it print `root` if you type `whoami`. But I guess not - otherwise I would've recommended installing packages using the distribution package manager (like `apt-get` for Debian etc). What error do you get when you try to run the binary? What does `uname -a` say? – Kenney Nov 03 '15 at 20:16
  • Nope, I don't have root. uname -a: Linux just49.justhost.com 3.12.49-35.ELK6.x86_64 #1 SMP Fri Oct 9 18:26:47 CDT 2015 x86_64 x86_64 x86_64 GNU/Linux The error I get when I type in "pdfinfo filename.pdf" is -bash: pdfinfo: command not found – tomc Nov 03 '15 at 20:19
  • if this is a regular shared host, your unlikely to have the ability to install anything –  Nov 03 '15 at 20:21
  • So there's no way to get pdfinfo to work? – tomc Nov 03 '15 at 20:23
  • Thanks! So, you downloaded the linux binary (xpdfbin-linux-3.04.tar.gz), and unpacked it (tar xfz xpdfbin-....)? There should be a new directory, `xpdfbin-linux-3.04`, and in it you would find `bin64/pdfinfo`. Correct? – Kenney Nov 03 '15 at 20:24
  • Correct, that's where I'm at now. Not sure what to do with the contents of that folder though... – tomc Nov 03 '15 at 20:25
  • Allright, well, that bin64 directory is not in your `$PATH` (try `echo $PATH`), so bash won't be able to find it. Just type the full pathname to the pdfinfo executable and you should be set. Assuming that you downloaded to your home directory, type this: `cd ~` followed by this: `xpdfbin-linux-3.0.4/bin64/pdfinfo`. Does that do anything? (OR: you could `cd` to that `bin64` directory and type `./pdfinfo`) – Kenney Nov 03 '15 at 20:27
  • It's not in the home directory it's under /scripts. I tried going into /scripts and typing that in but nothing seems to happen. should I type the cd ~ together with the path name? Or cd ~ then enter, and then the path? I've tried both. One says no such file or directory and the other just takes me down a directory – tomc Nov 03 '15 at 20:31
  • Oops I just got it. It gives me a list of commands associated with it. – tomc Nov 03 '15 at 20:34
  • If you unpacked the .tar.gz in /scripts/, then there is a directory `/scripts/xpdfbin-linux-3.0.4/`, right? If so, typing this should work: `/scripts/xpdfbin-linux-3.0.4/bin64/pdfinfo` followed by enter. Allright, you got it! Now, you can either use that full path in your PHP code, or copy the `pdfinfo` file to a more convenient place. – Kenney Nov 03 '15 at 20:36
  • How would it look in the php code? exec(/scripts/xpdfbin-linux-3.0.4/bin64/pdfinfo etc.)? – tomc Nov 03 '15 at 20:38
  • 1
    Yes, like that. The only difference with the question you linked (they use shell_exec()) is that on your server, pdfinfo is not in the PATH, so you have to supply the full path. Other than that, there's nothing special - it should work just as on your WAMP. – Kenney Nov 03 '15 at 20:42
  • Sweet man! If you want to add it as a formal answer I'll give you the point – tomc Nov 03 '15 at 20:46

0 Answers0