PHP 5.2.10 and PEAR – Notice: Undefined variable: dorest in PEAR/Command/Install.php on line 1220

Today, after upgrading packages with apt-get on a server running Debian Lenny my PEAR installation seemed to be broken. PHP had been updated to 5.2.10 and PEAR version was now 1.8.0. So when I realised that PEAR wasn’t the latest stable I tried upgrading PEAR using the command I’ve always used: pear upgrade pear, where the first “pear” is the command we run, then the “upgrade” sub-command and finally the name of the package we want to work with, unsurprisingly “pear”.

So I type the following expecting a happy success message and get this instead:

# pear upgrade pear
Notice: Undefined variable: dorest in PEAR/Command/Install.php on line 1220
Notice: Undefined variable: latest in PEAR/Command/Install.php on line 1228
Notice: Undefined variable: latest in PEAR/Command/Install.php on line 1234
Warning: array_change_key_case(): The argument should be an array in PEAR/Command/Install.php on line 1234
Nothing to upgrade

After a quick look at the problem I figured out that it was a problem with the cached channel data that PEAR stores under a directory called ./channels in the PEAR installation directory. The problem is quickly solved by deleting the files in that directory. To find out where PEAR is installed you can use the “pear list-files” command as follows:

# pear list-files pear
Installed Files For pear
========================
Type Install Path
php /usr/local/zend/share/pear/OS/Guess.php
php /usr/local/zend/share/pear/PEAR/ChannelFile/Parser.php
...

Read more

Compiling Apache and PHP from source with IMAP, XMLRPC, GD, PEAR, cURL and MySQL support on Mac OSX Leopard

The reason I decided to write this tutorial is that it seemed pretty clear to me that I would find myself going through this same process again, and probably many times (every few months) and it has proved to be very useful and time saving. Leopard comes with the apache web server pre-installed, but in this case, as a web developer I need to have control over which PHP etensions are installed, so I need to compile the web server and PHP with the relevant options. Read more