Install PDFLib with PHP

Image for Install PDFLib with PHP from unsplash.com

By Andrew McCombe
July 9, 2009


To install the PDFLib functionality you need to do the following (on an Ubuntu box).

cd /tmp
wget http://www.pdflib.com/binaries/PDFlib/704p1/PDFlib-7.0.4p1-Linux.tar.gz.
tar xvfz PDFlib-7.0.4p1-Linux.tar.gz</pre>

Then install PDFLib using pecl:

sudo pecl install pdflib

This will ask for the path to PDFlib headers. Select '1' and enter:

/tmp/PDFlib-7.0.4p1-Linux/bind/c

Then hit enter. It should then finish.

Finally, add the pdf module to the PHP configuration and restart apache:

sudo echo "extension=libpdf_php.so" &gt; /etc/php5/conf.d/libpdf.ini
sudo /etc/init.d/apache2 restart

To check that it works, enter:

> php -i | grep "PDFlib GmbH"
PDFlib GmbH Version =&gt; 7.0.4p1