BOLEK's

Archive for March, 2013

pdflib y php

by on Mar.12, 2013, under Linux

Install apache2 (via synaptic or package manager)

PHP Code:
sudo apt-get install apache2

install php

PHP Code:
sudo apt-get install php5

For those who don’t know 9/10 the package manager will make your apache directory: /etc/apache2 (this is where apache2.conf and an empty httpd.conf file is located) NOTE That your apache2.conf is actually the file the server is using for the settings.
And php will be /etc/php5/apache2/ (this is where php.ini is located)

To load the PDF extension.

PHP Code:
wget http://www.pdflib.com/binaries/PDFlib/801/PDFlib-8.0.1p8-Linux-php.tar.gz /tmp

NOTE: this is for x86 not x64 you can find the download page here:
http://www.pdflib.com/download/pdflib-family/pdflib-8/

after unpacking the tarball

PHP Code:
/tmp$ sudo tar -xzvf PDFlib-8.0.1p8-Linux-php.tar.gz

This will create a bind and doc directory.

under /tmp/PDFlib-8.0.1p8-Linux-php/bind/php/

php-510
php-520
php-520mt
php-530
php-530mt

There will be some sub dir’s php-530 is for php5.30 etc… the mt directories are for multithreading servers.

To check if your server is multithreading and what version of php you have you can run a test script from your /var/www/ folder. just make a file called phpinfotest.php and put this in it:
<?php phpinfo() ?>

then open the page http://localhost/phpinfotest.php

It will be quite likely that you won’t be using multi threading.

Anyhow, copy the libpdf_php.so to your extensions directory. (this is where I got lost because for some strange reason it was NOT /etc/php5/apache2/ext/ or something simple. This folder is located under the /usr/lib/php5/(some date like 20090626+lfs) in my case.

PHP Code:
sudo cp /tmp/PDFlib-8.0.1p8-Linux-php/bind/php/php-530/libpdf_php.so /usr/lib/php5/20090626+lfs/

Add the extension to your php.ini and you are done.

PHP Code:
sudo gedit /etc/php5/apache2/php.ini

add this like to where the extensions are
extension=libpdf_php.so

save & close.

restart apache2.

PHP Code:
 sudo /etc/init.d/apache2 restart

Test its working by running your phptestinfo.php again in your browser. If you can find something like:

PDF Support enabled
PDFlib GmbH Binary-Version 8.0.1p8
PECL Version 2.2.0
Revision $Revision: 1.20.2.2 $

Taken from http://ubuntuforums.org/showthread.php?t=1622815

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...