Posts Tagged ‘rhel’

How I had to fix PHP PEAR

Monday, March 10th, 2008

I’ve always found the code libraries of PHP PEAR to be quite useful.

But the PEAR website and individual package documentation is often baffling. I wish users could contribute comments and sample code easily, like the online documentation of PHP.

On to today’s rant. I just upgraded the Linux distribution that runs my home server to SME7, see contribs.org. Since it’s based on Red Hat Enterprise Linux, it comes with an old version of PHP Pear. Out of the box, it does not work. This is OK. On the frontpage of pear.php.net homepage the reason is clearly posted:

“[January 3, 2008] As promised, XML-RPC has been disabled at pear.php.net.”

The news post tells you how to update older installs of PEAR to work with the new system. That would be fantastic, if the instructions worked.

But they don’t. At least for older than expected versions of PEAR.

Fortunately, I have notes from earlier this year on another server upgrade I did.  I had to search high and low to get my old version of Pear working. Earlier this year, I run these commands to upgrade and fix PEAR:

pear upgrade –force http://pear.php.net/get/Archive_Tar http://pear.php.net/get/XML_Parser http://pear.php.net/get/Console_Getopt-1.2

(note, that’s all one command up there)

pear upgrade –force http://pear.php.net/get/PEAR-1.4.3.tar


pear upgrade PEAR

The difference is the Console_Getopt-1.2 line. It specifies the exact version of the Console_Getopt package to install. Shrug.

Today, I had an extra step:

On the second command, the PEAR-1.4.3.tar one, I go this error:
requires package `PEAR’ >= 1.3.3

I guessed that I needed to do a half-step upgrade first… i.e.
pear upgrade –force http://pear.php.net/get/PEAR-1.3.3.tar

Then do the original line:
pear upgrade –force http://pear.php.net/get/PEAR-1.4.3.tar

Then the final upgrade:
pear upgrade PEAR

I don’t know why PEAR had to disable the XML-RPC interface.  I don’t really care.  But I do find it annoying when the instructions on the front page of a site don’t work.

This problem will affect other people besides me. This will probably hit everyone else who is installing a new RHEL4 (or derivative) server. Long life distributions with non-functional PHP PEAR software will be kicking around for a few more years.

I’d post this on the PEAR Wiki. But there is none. Fortunately, this blog gets indexed by the search engines, so maybe it will prove useful to someone other than me.