Archive for the ‘personal’ Category.

Installing PDFlib Lite on Linux

I had some trouble, maybe if someone else has the same trouble I can help.

1. I downloaded the source code at the pdflib site

2. I unpacked it and ran the configure and make commands and such. So far so good.

3. I realized that unlike the full version, this doesn’t come with the php extension bindings.

4. Tried to use pear install pdflib like the instructions said, but that failed, so I tried pecl, but it claimed my gcc didn’t work:

# pear install pdflib
No releases available for package “pear.php.net/pdflib” – package pecl/pdflib can be installed with “pecl install pdflib”
Cannot initialize ‘pdflib’, invalid or missing package file
Package “pdflib” is not valid
install failed
# pecl install pdflib
downloading pdflib-2.1.5.tgz …
Starting to download pdflib-2.1.5.tgz (55,579 bytes)
………….done: 55,579 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
1. path to pdflib installation? :

1-1, ‘all’, ‘abort’, or Enter to continue: 1
path to pdflib installation? [] : /usr/local
1. path to pdflib installation? : /usr/local

1-1, ‘all’, ‘abort’, or Enter to continue:
building in /var/tmp/pear-build-root/pdflib-2.1.5
running: /root/tmp/pear/pdflib/configure –with-pdflib=/usr/local
checking for egrep… grep -E
checking for a sed that does not truncate output… /bin/sed
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… configure: error: cannot run C compiled programs.
If you meant to cross compile, use `–host’.
See `config.log’ for more details.
ERROR: `/root/tmp/pear/pdflib/configure –with-pdflib=/usr/local’ failed
#

So that failed. I don’t know why, because my gcc does work. Anyway, the solution was to start the pecl process, then open another terminal window and copy the /root/tmp/pear/pdflib/ files to another directory.

Then manually run configure –with-pdflib=/usr/local there.

(I also ran into trouble because I wasn’t giving /usr/local as the directory. I was giving /usr/local/lib which was where libpdf.so was. Trouble was, it needed pdflib.h which was in /usr/local/include. So giving /usr/local it knows to look both places. The error code I was getting was: configure: error: pdflib.h not found! Check the path passed to –with-pdflib=. PATH should be the install prefix directory.)

Then run make, then make test, then make install, and you’re done! You should now have pdf.so in your php extension directory, which is extension_dir in your php.ini file.

Hope that helps anyone googling for a solution based on error codes they’ve gotten.