Thursday, August 9, 2012

Installation of PDF support in PHP of Linux

    PDF functions in PHP can create PDF files using the PDFlib library which was initially created by Thomas Merz and is now maintained by  PDFlib GmbH. Here is the below procedure to enable the PDFlib-lite and PDFlib in the linux

#cd /usr/src/
#wget http://www.pdflib.com/binaries/PDFlib/705/PDFlib-Lite-7.0.5p3.tar.gz
#tar xvf PDFlib-Lite-7.0.5p3.tar.gz
#cd PDFlib-Lite-7.0.5p3
#./configure --prefix=/usr/local/pdflib --without-java
#make && make install

After installing the PDFLite, we have to built PDFlib DSO as below.
#cd /usr/src/
#wget http://pecl.php.net/get/pdflib-2.1.9.tgz
#tar xvf pdflib-2.1.9.tgz
#cd pdflib-2.1.9
#phpize
#./configure
#make && make install

A pdf.so file will be created in the PHPs extension directory which you can locate using the following command. If the file is not created there, copy it from the current location to the extension directory.

Append the pdflib extension in php.ini as below

#vim /etc/php.ini

   extension="pdf.so"

Then, Restart apache service to take effect of php.ini

Now, You can see the pdflib module in php by running the below command

#php -m | grep pdf

1 comment: