且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在基于 linux 的(共享主机)Web 服务器上安装 wkhtmltopdf

更新时间:2023-11-07 18:21:40

我已成功在没有 root 访问权限的共享主机帐户上安装 wkhtmltopdf-amd64.

I've managed to successfully install wkhtmltopdf-amd64 on my shared hosting account without root access.

这是我所做的:

从这里下载相关的静态二进制 v0.10.0:http://code.google.com/p/wkhtmltopdf/downloads/list

Downloaded the relevant static binary v0.10.0 from here: http://code.google.com/p/wkhtmltopdf/downloads/list

以上已移至此处

通过我的共享主机上的 ssh 输入以下内容:

via ssh on my shared host typed the following:

$ wget {relavant url to binary from link above}
$ tar -xvf {filename of above wget'd file}

然后,您将在主机上拥有二进制文件,并且无论它是否在/usr/bin/文件夹中,都可以运行它.(或者至少我能够)

you'll then have the binary on your host and will be able to run it regardless of if its in the /usr/bin/ folder or not. (or at least i was able to)

测试:

$ ./wkhtmltopdf-amd64 http://www.example.com example.pdf

  • 请注意,如果您在可执行文件所在的文件夹中,您可能应该以 ./ 开头以确保安全.
    • Note remember that if you're in the folder in which the executable is, you should probably preface it with ./ just to be sure.
    • 无论如何都为我工作