3

wkhtmltopdf 0.11.0 and earlier install simply copying linux static binary file to web server as here https://stackoverflow.com/a/3116571/2464199

and run it via PHP command like

exec('/path/to/wkhtmltopdf-amd64 file.html file.php');

In newer versions wkhtmltopdf (0.12.0 and later) no static binary file.

How can I install it now on shared hosting account without root access?

OS on web server:

Linux multidomain1.hostsila.com 2.6.18-274.el5 #1 SMP Fri Jul 22 04:43:29 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux

Linux version 2.6.18-274.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Fri Jul 22 04:43:29 EDT 2011

CentOS release 5.10 (Final)

Community
  • 1
  • 1
Modder
  • 882
  • 11
  • 21

1 Answers1

4

If you see the official binaries for 0.12.1, they are actually RPMs. If you do not have root access on the server, you can simply run the following command to extract the RPM contents:

rpm2cpio wkhtmltox-0.12.1_linux-centos5-amd64.rpm | cpio -idmv

You should get the binaries in the usr/local/bin subfolder, which you can then copy to any location that you want.

Please note that you may need to ask the host to install the dependent packages (fontconfig freetype libpng zlib libjpeg openssl libX11 libXext libXrender libstdc++ glibc) if they are not already installed.

ashkulz
  • 792
  • 3
  • 6
  • Thanks for the command! Static binary file is done. But wkhtmltopdf has an error when running: `Segmentation fault (core dumped)`. Version 0.11.0 and 0.10.0 working without errors. – Modder Jul 11 '14 at 19:09
  • Do you get the crash on any input or on some files only? – ashkulz Jul 11 '14 at 20:56
  • On almost all files. On the rest files I get this error `terminate called after throwing an instance of 'std::bad_alloc'` – Modder Jul 12 '14 at 11:48
  • Can you see if the binaries work for you in a VM if you have root access? I suspect that it is something to do with your web server which has enabled some security settings which cause a crash in `wkhtmltopdf`. – ashkulz Jul 12 '14 at 12:49
  • I have no possibility to do this. Thank you anyway. Already, it is not necessary. I use the earlier version which works fine. – Modder Jul 13 '14 at 00:17