You are here

Installing a legacy pear package in Xubuntu 20.04

Submitted by Druss on Sat, 2020-09-26 20:03

Trying to install a legacy pear package on a new version of Ubuntu is a bit of a chore as things are broken. For starters, using

$> sudo apt install php-pear

$> sudo pear install foo

results in errors such as

Notice: Trying to access array offset on value of type bool in PEAR/REST.php on line 187

and

Notice: Trying to access array offset on value of type null in PEAR/Command/Remote.php on line 354
PHP Notice:  Trying to access array offset on value of type null in /usr/share/php/PEAR/Command/Remote.php on line 354

Things to try:

  • sudo mkdir -p /tmp/pear/cache
  • sudo pear channel-update pear.php.net

    and

    sudo pear list-all -c pear.php.net
  • Manually fix the offending statement on line 187 as per the error message:
    sudo vi /usr/share/php/PEAR/REST.php

    This involves checking if the $cacheid variable is null or not.

  • Try the pear statements again; it worked for me.
  • Install your package: sudo pear install FOO
    sudo pear install Numbers_Words-0.18.2