1

I'm using installation of wkhtmltopdf (I even copied instalation from other directory) on my localhost (windows xp) simply by callling exec function. Everything works good.

How can I use it on linux share web server? Admin claimed, that it is neccesary compile that and nothing like copy and immedeatelly using is not on linux possible.

I tried

exec('./library/External/wkhtmltopdf-i386 --V');

but nothing happened (any error, file_exists is true). It is true, that it is not possible to use it like I use it in windows?

I used wkhtmltopdf-0.9.9-installer.exe on localhost from http://code.google.com/p/wkhtmltopdf/downloads/list.

On shared server (linux) I used wkhtmltopdf-i386 (it isn't .exe or .dll ... it's linux version) from the same source.

tomasr
  • 485
  • 1
  • 8
  • 24
  • What files did you copy? Where did you get "wkhtmltopdf-i386" from? Is it the `.exe` or `.dll` file or not? The answer below seems to suggest that it is but I'm not quite sure as usually they are not named like that in winodws environments. Can you run it via shell/console? – Joel Peltonen Apr 15 '13 at 05:36
  • I edited my question. I did't run it via shell/console, because I don't understand linux at all. You thing via SSH? – tomasr Apr 15 '13 at 07:54

2 Answers2

0

Yes, it is true. You can't (in most cases) just copy a binary executable file to a linux system and expect it to work. It will have to be compiled.

You can try here to see if this helps at all: How to install wkhtmltopdf on a linux based (shared hosting) web server

Community
  • 1
  • 1
blockhead
  • 9,655
  • 3
  • 43
  • 69
  • I saw that. How it's thought comment on same link, which you gave me (http://stackoverflow.com/questions/2273534/how-to-install-wkhtmltopdf-on-a-linux-based-web-server#comment-16396726) or this http://stackoverflow.com/questions/3713004/help-installing-static-binary-for-wkhtmltopdf#answer-3945664? – tomasr Apr 15 '13 at 07:45
  • This is not the problem here, I think. It should work, actually. – Joel Peltonen Apr 16 '13 at 18:23
0

I would add this as comment but it is a little too long.

Your file I think should be OK. Try running the following commands

shell_exec('./library/External/wkhtmltopdf-i386 --asdasdsadsad 2>> err1.txt 1>> out1.txt');
shell_exec('./library/External/wkhtmltopdf-i386 --version 2>> err2.txt 1>> out2.txt');

Then check what is output into the files out1.txt, err1.txt, out2.txt, err2.txt. This might give you some clues. The 2>> forwards the STDERR output of the program to a text file and 1>> forwards the STDOUT to a text file. One of these should contain something interesting.

One things that might cause issues would be if the file is not marked executable in the server - linux identifies executables based on a meta data attribute, but I don't know how you would check in your case if it is - usually I would run the command ls -la in the console to see file permissions and information. The outputs of the previous commands might contain clues.

Joel Peltonen
  • 13,025
  • 6
  • 64
  • 100
  • The difference between `exec` and `shell_exec` should not matter here, I'm just used to always calling this one :) -- http://stackoverflow.com/questions/7093860/php-shell-exec-vs-exec – Joel Peltonen Apr 22 '13 at 06:12