Install "Non-Stable" PEAR Packages

Today I needed to install two PEAR packages on my machine. When I did, I got this:

me@mine [~] $ sudo pear install ole
Failed to download pear/ole within preferred state "stable", latest release is version 1.0.0RC1, stability "beta", use "channel://pear.php.net/ole-1.0.0RC1" to install
Cannot initialize 'channel://pear.php.net/ole', invalid or missing package file
Package "channel://pear.php.net/ole" is not valid
install failed

I’d seen this message before, but never at a time or place where it was important for me to dig in and figure out a way around it. Today I needed to do just that and I found that there are two ways.

Install This Beta Package, This One Time

To do this, simply follow the instructions in the error message:

$ sudo pear install channel://pear.php.net/ole-1.0.0RC1

By explicitly defining the channel from which to install the unstable package, PEAR seems to assume that you know exactly what you’re doing and leaves you alone to do it.

Allow Non-Stable Packages Without Complaining

The ability to “tinker” with libraries is somewhat inherent to a development environment so this is the direction I chose to go. I learned that PEAR recognizes the following application states (though I’m not sure exactly how each is defined):

  1. stable
  2. beta
  3. alpha
  4. devel
  5. snapshot

This information can be shown by running the pear executable’s config-help command:

$ pear config-help preferred_state

I decided to lower my standards gradually in order to protect some level of stability while still getting the functionality I needed. I opted to lower my preferred_state to beta.

$ pear config-set preferred_state beta

Now I can install beta packages normally (i.e. I no longer have to specify a channel) without all of the whining. PEAR doesn’t make this information as easy to find as I’d have liked, so maybe this will help someone else.

Subscribe1 Comment on Install "Non-Stable" PEAR Packages

  1. Mike said...

    Thanks for the tip – very useful.