Recipe 26.5. Upgrading PEAR Packages

26.5.1. Problem

You want to upgrade a package on your system to the latest version for additional functionality and bug fixes.

26.5.2. Solution

Find out if any upgrades are available and then tell pear to upgrade the packages you want:

% pear list-upgrades % pear upgrade -o Package_Name

26.5.3. Discussion

Upgrading to a new version of a package is a simple task with the PEAR installer. If you know a specific package is out of date, you can upgrade it directly. However, you may also just want to check periodically to see if any new releases are available.

To do this, use the list-upgrades command, which prints out a table showing the channel server of the package, package name, local version number and state, version number and state of the remote upgrade, and size of the download of the upgrade:

% pear list-upgrades Available Upgrades (stable): ========================================= Channel       Package             Local           Remote          Size  HTML_Table          1.6.1 (stable)  1.7.0 (stable)  13.7kB  HTML_Template_IT    1.1.3 (stable)  1.1.4 (stable)  19.7kB  Log                 1.9.3 (stable)  1.9.5 (stable)  37kB  Mail                1.1.9 (stable)  1.1.10 (stable) 16.5kB  MDB2                2.0.0 (stable)  2.0.1 (stable)  90kB  Pager               2.3.6 (stable)  2.4.1 (stable)  31kB  PEAR                1.4.8 (stable)  1.4.9 (stable)  277kB  Services_Weather    1.3.2 (stable)  1.4.0 (stable)  53kB

If you're up to date, pear prints:

Channel No upgrades available

To upgrade a particular package, use the upgrade command. For example:

% pear upgrade MDB2 Did not download dependencies: pear/PEAR, use --alldeps or --onlyreqdeps to download automatically downloading MDB2-2.0.1.tgz ... Starting to download MDB2-2.0.1.tgz (91,219 bytes) .....................done: 91,219 bytes upgrade ok: channel://

The short command for list-upgrades is lu; for upgrade it's up.

PEAR also has an RSS feed listing new and upgraded packages is available at An aggregated RSS feed listing new and upgraded packages available on the PEAR site and a variety of other PEAR Channels is available at

26.5.4. See Also

Recipes 13.12 and 26.7 for information on installing PEAR and PECL packages; Recipe 26.6 to uninstall a package; Recipe 12.12 for more on parsing RSS feeds.

PHP Cookbook, 2nd Edition
PHP Cookbook: Solutions and Examples for PHP Programmers
ISBN: 0596101015
EAN: 2147483647
Year: 2006
Pages: 445

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: