How to install PDFlib-Lite & PDFlib on a CentOS server?

PDFlib is a free library used for generating and manipulating files in Portable Document Format (PDF). The primiary goal of PDFlib is to create dynamic PDF documents on a Web server OR similar systems and to allow a “save as PDF” capability.

The following steps will help you to install PDFlib-lite and PDFlib on a CentOS server OR even on a cPanel and Plesk servers.

SSH to the server as a ‘root’ user:

1) Download the PDFlib-Lite package required for PDFlib installation in a temporary directory

# cd /usr/local/src 
# wget http://www.pdflib.com/binaries/PDFlib/705/PDFlib-Lite-7.0.5.tar.gz

2) Unpack the package and goto the PDFlib-Lite directory

# tar -zxf PDFlib-Lite-7-* 
# cd PDFlib-Lite-7.0*

3) Now, configure PDFlib-Lite

# ./configure --prefix=/usr/local

4) Create the installation files and install PDFlib-Lite

# make 
# make install

5) Once PDFlib-Lite is installed, download ‘PDFlib’ using pecl.

# pecl download pdflib

6) Unpack the package and goto the PDFlib-Lite directory

# tar xvzf pdflib-*.tgz 
# cd pdflib-*

7) Create configuration files

# phpize

8 ) Now, configure PDFlib

# ./configure

9) Create the installation files and install PDFlib

# 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.

# php -i | grep extension_dir

The final step is to add the PDFLib extension in the php.ini file and restart the Web Server.

extension="pdf.so"

Note: Using the above instructions, PDFlib can be installed on the cPanel and Plesk servers as well. Though the location of extension_dir and php.ini are different, they can easily be located using the commands above.

This entry was posted on Thursday, January 13th, 2011 and is filed under Installations. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

2 Responses to “How to install PDFlib-Lite & PDFlib on a CentOS server?”

  1. r2g2

    Hi –

    I had previously installed PDFlib Lite 7.0.5 on my virtual dedicated server on Godaddy. However, since it was giving me FATAL errors about an object being called I tried installing the PDFlib again by following the instructions given above – however, could not locate the pdf.so file in any directory.

    Kindyl assist urgently as the error I get now is given below:
    Fatal error: Call to undefined function pdf_new()

    I believe this means that I have totally undone my PDFlib installation.

    Please assist – Do I need to uninstall my previous installations and then redo it or can I repair the same?

    Thanks

    R2G2

  2. admin

    Hello r2g2,

    Yes, remove the previous installation first and then perform the new installation. To remove older installation, goto the old PDFlib directory and execute

    make clean

    and then remove the pdf.so file too.
    Once done, install the required version with the steps given in the post. During the “make install” step, it will point you to a directory where it creates the new pdf.so file. You can either copy it from their to your server’s PHP extension directory OR create a symlink.