Book HomePHP CookbookSearch this book

21.7. Upgrading PEAR Packages

21.7.1. Problem

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

21.7.2. Solution

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

% pear list-upgrades
% pear upgrade Package_Name

21.7.3. Discussion

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

To do this, user the list-upgrades command, which prints out a table showing package names, the new version number, and the size of the download:

% pear list-upgrades
Available Upgrades (stable):
=  ==  ==  ==  ==  ==  ==  ==  ==  ==  ==  ==  ==  ==  =
+-------------+---------+--------+
| Package     | Version | Size   |
| Archive_Tar | 0.9     | 8.9kB  |
| Auth        | 1.0.2   | 8.8kB  |
| Auth_HTTP   | 1.0.1   | 1.7kB  |
| DB          | 1.3     | 58kB   |
| HTTP        | 1.1     | 2.9kB  |
| Mail        | 1.0.1   | 11.6kB |
| Mail_Mime   | 1.2.1   | 15.0kB |
| Net_Ping    | 1.0.1   | 2.1kB  |
| Net_SMTP    | 1.0     | 2.8kB  |
| Net_Socket  | 1.0.1   | 3.5kB  |
| PEAR        | 0.9     | 40kB   |
| XML_Parser  | 1.0     | 4.8kB  |
| XML_RPC     | 1.0.3   | 11.9kB |
| XML_RSS     | 0.9.1   | 3.1kB  |
| XML_Tree    | 1.1     | 4.7kB  |
+-------------+---------+--------+

If you're up to date, pear prints:

No upgrades available

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

% pear upgrade DB
downloading DB-1.3.tgz ...
...done: 59,332 bytes

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

PEAR also has an RSS feed listing new packages available at http://pear.php.net/rss.php.

21.7.4. See Also

Recipe 21.5 and Recipe 21.6 for information on installing PEAR and PECL packages; Recipe 21.8 to uninstall a package; Recipe 12.12 for more on parsing RSS feeds.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.