$20 for first person to answer pdflib question



I need instructions for how to set up pdflib in my home directory, without installing a new version of PHP. Note: my domain is set to use PHP5.

I tried following the PEAR instructions on the wiki, but they don’t work when I run /usr/local/php5/bin/pecl install pdflib at the end of them. Those instructions are here: http://wiki.dreamhost.com/index.php/PEAR

Output of pecl install pdflib is here:
[laurel]$ /usr/local/php5/bin/pecl install pdflib
downloading pdflib-2.1.2.tgz …
Starting to download pdflib-2.1.2.tgz (55,669 bytes)
…done: 55,669 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20050606
/usr/local/bin/phpize: /usr/local/tmp/tmpeano7Z/pdflib-2.1.2/build/shtool: /bin/sh: bad interpreter: Permission denied
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.

ERROR: `phpize’ failed

This is NOT A JOKE. If you can tell me how to install pdflib onto a DH domain without installing my own PHP, I will send you $20 via PayPal or Postal Mail or something else you might prefer. I need this functionality for my business and do not want to maintain my own php installation.

I have the feeling that setting a few environment variables for phpize and other php functions from the v4 ones to the v5 ones will do a lot, as will specifying where autoconf is.


  • You’re the only one so far
  • Fine, it’s $40 now
  • Yes, I feel like this should be on the wiki already.


[Hopefully you can follow my instructions. I find these things much easier to do myself than to explain, but I’ll try to lay everything out step by step for you.]

You really should install your own custom PHP in order to use PDFlib, and thanks to the Dreamhost wiki, doing that is pretty simple. It’s mostly copy and paste.


Follow the easy instructions they give, using the first installation script which is linked to. Change line 4 to have your domain name, making sure it’s the same domain name as listed in your home directory. For example, if your domain is listed as DOMAIN.COM instead of WWW.DOMAIN.COM, make sure you use DOMAIN.COM on line 4. Execute the script from your home directory, not from your domain directory.

It’s going to take a while to build, so go find something interesting to do while you’re waiting. If you log in with another SSH session, now would be a good time to go ahead and follow the instructions in the same wiki entry about modifying your .htaccess file. Otherwise don’t forget to do that when it’s done.

After your screen settles down and PHP is done, confirm that under the domain you installed to you see a cgi-bin folder with the file php.cgi inside. If not, you probably made a typo on line 4 of your install script. In that case, go back to your home directory and look for a new folder with your mistyped domainname. Copy the cgi-bin to your domain directory and make sure you copy the php.cgi that’s in it as well.

Back in your home directory again, do the following:

wget http://www.pdflib.com/binaries/PDFlib/700/PDFlib-7.0.0p3-Linux-php.tar.gz
tar -xvvzf PDFlib-7.0.0p3-Linux-php.tar.gz

Now, go to your domain’s cgi-bin directory and do this:

cp …/…/PDFlib-7.0.0p3-Linux-php/bind/php5/php-520/libpdf_php.so ./

Now copy your php.ini to cgi-bin:

cp …/…/php5/etc/php5/DomainNameYouUsedInLine4/php.ini ./

Now edit php.ini. I usually use pico just because that’s what I’m used to.

pico php.ini

Ctrl-W to find extension_dir

Make sure extension_dir = “./”

Now, add a line:


Ctrl-O to Save
Ctrl-X to Exit

Now… you’re done! To make sure everything worked, put the following script into a test file:

<?php phpinfo(); ?>

Save it to something like test.php, then load it up in your web browser. If it worked, you should be able to scroll down and see:

PDF Support enabled
PDFlib GmbH Binary-Version 7.0.0p3
PECL Version 2.1.0
Revision $Revision: 1.5 $

Any questions or problems, e-mail me at michael@furthervoyages.com.



Unfortunately, your tutorial requires a custom PHP compilation, which the original poster insists he does not want to use. :wink:

That said, your post is a very nice piece of work, explains the process very clearly, and I’m sure it will be very useful to many! :slight_smile:



In this case, it’s actually easier than using PEAR. To get PEAR to complete, he’d have to set up autoconf and do further editing of his environment in order to continue, and still might not get it to work due to other complications of trying to do anything under Dreamhost’s install of PHP. I spent a while on it and finally gave up because it was needlessly complicated, but doing it with a custom install was easy as pie and only took a couple minutes (not counting compile time).

I know I didn’t meet his requirements, but if he wants to get up and running as painlessly as possible I hope he follows my advice. I’d be happy to do the setup for him if he doesn’t want to do it himself.

I’ll spend some time later on Wikifying the instructions so they’ll be easier to read and easier for others to find.


I agree completely and it’s likely true he would still need to “tweak” the default PHP somewhat.

That would be great and, as I wrote in my earlier post, I’m sure many will find it very useful. Thanks for doing all that!



Alright misoman, I’ll take your answer despite using a custom PHP. PM me with your e-mail address.

Please post the custom PHP instructions AND the incomplete non-custom PHP instructions you worked on to the DH Wiki. When I see it’s up there, I’ll pay up immediately.

I have two questions left and there’s still $20 in them if someone can answer:

  • Can anyone go the non-custom PHP route and figure out the Autoconf/Environment variable trouble?
  • And related, how would I compile an arbitrary PHP5 extension from source? (ex. http://www.hardened-php.net/suhosin.127.html - just the PHP extension part, not the patch to PHP part)



Sorry, but I’m not going to post incomplete instructions. You’re welcome not to pay me if that’s your choice.

It’s not an issue of being unable to set up autoconf, as that part’s easy enough, it’s that Dreamhost’s default setup ultimately does not want you installing low-level extensions like PDFlib. Normal PEAR modules might work with the default install, but PECL stuff is never or almost never going to work. I tried just in case Dreamhost had changed anything since the last time I worked on it a long time ago, but the same roadblocks are in place.

In any case, I’m glad I didn’t succeed. If I had, I would have sent Dreamhost a notice that they need to tighten their ship. For system stability and security, Dreamhost simply won’t and shouldn’t support low-level extensions with their main install. I can’t blame them. It’s much simpler and safer to let people set up their own PHP installations and then if something goes wrong, the issue won’t affect all the other users on the same machine. Even if it’s somehow possible to do what you want, it’s not what Dreamhost wants you to do, and I’m not going to post incomplete, non-functioning instructions which will encourage other people to try to go about this install in the wrong way. Doing things the way you want to do them is not only complicated, but potentially dangerous if someone succeeds. I’m not going to spend any more time on it and neither should you.

Anyway, I’ll try to get the wiki instructions up tonight. I’ve barely done any wiki editing before, so it may take me a revision or two to get it looking nice. I hope people will find them helpful. PDFlib is a great library.


That also requires you to have a custom PHP install. The procedure for compiling any extension can vary, but in the ideal case it would be just a matter of downloading and expanding the archive, running a configure script followed by make, then editing a line or two in php.ini. In other cases, it might not be so easy.


Ok, I understand. Send me a PM with your e-mail.


Update: Wiki is live at http://wiki.dreamhost.com/index.php/PDFlib