How To Install PDFlib Lite (and the PHP .so)
By Cade • Jun 19th, 2008 • Category: PHPThis tutorial has been tailored to and tested for Bluehost.com's shared servers, but it should work on pretty much any shared host that allows SSH access (your mileage may vary). If your host falls short, quit settling and try Bluehost.
I regularly get requests to install PDFlib Lite on servers, but have to turn them down due to licensing concerns (installing software licensed for personal use on a business machine with 450 users can be tricky), now you can install it on your own. Let’s get started by first installing PDFLib Lite.
Grab the source package
cd ~/tmp/ wget http://www.pdflib.com/binaries/PDFlib/703/PDFlib-Lite-7.0.3.tar.gz
Unpack the archive
tar xvzf PDFlib-Lite-7.0.3.tar.gz
Compile PDFlib Lite
cd PDFlib-Lite-7.0.3 ./configure --prefix=$HOME/usr --without-java make make install
You may see an error about a failure to copy to /usr/local/lib for Python and Perl. You can safely ignore it. If it bothers you that much, add --without-python --without-perl to the configure and re-make install.
Build the PDFlib DSO for PHP
cd ~/tmp pecl download pdflib tar xvzf pdflib-*.tgz cd pdflib-* phpize ./configure --with-pdflib=$HOME/usr make
At this point, you have a built pdf.so file in ~/tmp/pdflib-*/modules. Copy it somewhere safe. I like to create an extension directory locally for all my extensions (you need to create it if doesn’t already exist).
cp ~/tmp/pdflib-*/modules/pdf.so ~/extensions
Now to implement it. Add/ modify the following in your php.ini:
extension_dir=/home/<username>/extensions extension=pdf.so
Note: If you depend on system installed extensions (ie. PDO_MySQL) you will need to copy them into your local extension directory.
cp /usr/lib/php/extensions/*/* ~/extensions
This copy may be unpredictable if there are multiple no-debug-non-zts- directories. If so, copy the extensions from the newer directory.
Cade is busy attempting to rid the shared hosting world of technical questions without answers. Have a request? Send it to me.
All posts by Cade