How To Install wkhtmltopdf PHP Bindings
This isn’t a difficult process, but I’m sure I’ll need it again, so here it is.
Pre-requisites:
- Download the latest version of
libwkhtmltox
and the source ofwkhtmltopdf
from Google Code. - Copy
lib/libwkhtmltox.so
fromlibwkhtmltox
to/usr/local/lib
. - Copy
include/wkhtmltox
fromwkhtmltopdf
to/usr/local/include
. -
Run the following command (just to make sure it’s loaded):
$ldconfig -v | grep wkhtml
PHP Bindings:
- Grab php-wkhtmltox from GitHub.
- Install.
Installation:
If development tools aren’t installed:
$apt-get install build-essential php5-dev # (ubuntu)
$phpize
$./configure
$make install
Add extension=phpwkhtmltox.so
to php.ini
.
P.S. These instructions are for Ubuntu. If you’re on CentOS, things are more difficult, good luck.