Login   Register  
PHP Classes
elePHPant
Icontem

File: compile_phpwkhtmltox.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of PHP-4-Business  >  WKHTMTOPDF HTML to PDF creator  >  compile_phpwkhtmltox.txt  >  Download  
File: compile_phpwkhtmltox.txt
Role: Documentation
Content type: text/plain
Description: How to compile the PHP extension
Class: WKHTMTOPDF HTML to PDF creator
Convert HTML to PDF using the Webkit engine
Author: By
Last change: Corrections to commands
Date: 2 years ago
Size: 1,831 bytes
 

Contents

Class file image Download
Here are some steps to compile and install the php-wkhtmltox PHP extension.

The paths below are valid for most standard Centos/RH installations - you should check and adapt them according to your flavour of Linux.



On your server:

1) Download the wkhtmltopdf src package

  cd  /tmp
  wget  http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1.tar.bz2
  bunzip2  wkhtmltopdf-0.11.0_rc1.tar.bz2
  tar  -xvf  wkhtmltopdf-0.11.0_rc1.tar


2) Download the pre-compiled libwkhtmltox static library

  cd  /tmp
  wget  http://wkhtmltopdf.googlecode.com/files/libwkhtmltox-0.11.0_rc1-i386.tar.bz2
  bunzip2  libwkhtmltox-0.11.0_rc1-i386.tar.bz2
  tar  -xvf  libwkhtmltox-0.11.0_rc1-i386.tar


3) Copy the library to your libraries directory (probably /usr/local/lib )

  cp  -v /tmp/lib/libwkhtmltox.so   /usr/local/lib


3) Copy the library headers to your headers directory (probably /usr/local/include )

  cp  -vR  /tmp/include/wkhtmltox  /usr/local/include/wkhtmltox


4) Download the PHP extension source

  cd  /tmp
  wget  --no-check-certificate  https://github.com/mreiferson/php-wkhtmltox/tarball/master  
  tar  -xvzf  master



5) Compile and install the extension

  cd  /tmp/mreiferson-php-wkhtmltox-fa6208e
  phpize 
  ./configure  --with-phpwkhtmltox=/tmp/wkhtmltopdf-0.11.0_rc1
  make
  make install

	
6) Edit your php.ini file to load the extension

  cp  /etc/php.ini  /etc/php.bak
  echo  "extension=phpwkhtmltox.so"  >> /etc/php.ini 


7) Reload your webserver and test

  apachectl  restart

- creates a test image file called  /tmp/test.jpg

  cd  /tmp/mreiferson-php-wkhtmltox-fa6208e
  php  test_image.php


- creates a test pdf files called  /tmp/test1.pdf

  cd  /tmp/mreiferson-php-wkhtmltox-fa6208e
  php  test_pdf.php