1
votes

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.

2
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
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

2 Answers

0
votes

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

0
votes

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.