Recipe 26.6. Uninstalling PEAR Packages


26.6.1. Problem

You wish to remove a PEAR package from your system.

26.6.2. Solution

The uninstall command tells the PEAR installer to delete packages:

% pear uninstall Pager uninstall ok: channel://pear.php.net/MDB2-2.4.1

26.6.3. Discussion

Uninstalling a package removes it completely from your system. If you want to reinstall it, you must begin as if the package was never installed.

If you try to remove a package another package depends on, PEAR will warn you and halt the uninstall process. For example, take a look at a sample PEAR installation:

% pear list Installed packages, channel pear.php.net: ========================================= Package           Version State Archive_Tar       1.3.1   stable DB                1.7.6   stable HTML_Common       1.2.2   stable HTML_Table        1.7.0   stable MDB2              2.0.1   stable MDB2_Driver_mysql 1.0.1   stable PEAR              1.4.9   stable XML_Parser        1.2.7   stable XML_Tree          1.1     stable

Now, try to uninstall the MDB2 package:

% pear uninstall MDB2 pear/MDB2 cannot be uninstalled, other installed packages depend on this package

You can still force a package that has dependencies to uninstall by using the -n flag or --nodeps flag to instruct the PEAR installer to ignore dependencies and uninstall anyway. Use this capability with caution.

There is no way to automatically roll back an upgrade to an earlier version of a package by using uninstall. Also, PEAR complains if you try install an earlier version of a package over a later one. To force the PEAR installer to overwrite a newer version of a package with an older one, use install -f or install --force:

% pear install DB-1.7.5 Skipping package "pear/DB", already installed as version 1.7.6 No valid packages found install failed % pear install -f DB-1.7.5 downloading DB-1.7.5.tgz ... Starting to download DB-1.7.5.tgz (124,767 bytes) ............................done: 124,767 bytes install ok: channel://pear.php.net/DB-1.7.5

The short command for uninstall is un.

26.6.4. See Also

Recipes 13.12 and 26.7 for information on installing PEAR and PECL packages.




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

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net