Ugh, that was irritating

OK, this is going to start out being technical (actually, the entire thing will be technical). So you might want to skip this unless you’re a hardcode geek.

Now that the warning’s been issued:

I finally decided to take another swing at OpenID. Specifially, the WordPress OpenID plugin. It just wouldn’t work on this site (Dreamhost doesn’t have the GMP library installed, and the fallback method failed to work). This didn’t bother me in the past, but it finally got to the point (again) that it bothered me that it didn’t work. I think the last straw was when I tried to sign into  So Google to the rescue!

It took a while, but eventually I came across a blog post from someone with a Dreamhost account, who described how to compile a custom PHP5 with GMP support. And that article pointed to a page on a Dreamhost support wiki (imagine that) that had shell scripts which were supposed to handle most of the heavy lifting (compiling the dependencies first, for example).  Trouble is, I ran into a couple of problems with the automated scripts, so here are the changes that I made (which, incidentally, worked):

First, the scripts delete everything in ${INSTALLDIR} when they run. That means they also delete the GMP library that you may have just gone to the trouble of compiling and installing.  Three options here (I chose the 2nd):

  1. Comment out the line that reads rm -rf ${INSTALLDIR}
  2. Re-run the “make install” step of the GMP installation instructions, in another terminal, after the first script has started compiling something else. Just make sure you do this before PHP starts compiling.
  3. Hack the scripts even more than you already have, and add in the step of compiling libGMP.

Next, cURL wouldn’t compile because of a shared-library error in libssl (from OpenSSL). The specific error was:

/usr/bin/ld: /home/HOMEDIR/php5/lib/libssl.a(s2_clnt.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
/home/HOMEDIR/php5/lib/libssl.a: could not read symbols: Bad value

To fix that, I added “–shared” to the pre-compile config command for openssl; that ended up looking like

./config –shared –prefix=${HOME}/php5

after that, almost everything else compiled properly (although I had to compile OpenSSL twice, probably because I screwed up the source dir at some point during my first attempt; deleting the entire source dir and re-extracting everything let the compile succeed).

Except PHP, initially. PHP 5.2.6 is pretty old, and I neglected to update the version information in the download script (also, I think may have changed their download process).  So I downloaded PHP 5.2.10 direct from with wget, extracted it to the appropriate location, and updated the compile script to reference the new version.

Oh, and be sure to update ${DOMAIN} in that script as well; otherwise, the install portions at the very bottom won’t work quite right (or even at all). Also, note that at the bottom of that wiki page (below the “other alternate script”), there are some addenda that need to be added to your .htaccess file; don’t forget them if you plan on customizing your php.ini file.

Of course, there are drawbacks to having my own custom PHP5 installed. I’ll have to keep up with upgrades and security updates myself, and recompile whenever any changes happen. But I consider that a small price to pay to get what I wanted.

Published by


I write stuff on this blog. All of the stuff.