With the Pear Package Manager, you can browse and search for the packages you've contributed, view the latest releases, and download the packages. The syntax for executing it on the command line is as follows:%>pear [options] command [command-options]
Open a command-line prompt, execute%>pear, and output a set of common commands and some usage information.
%>pear Help can query the use of a command.
1. View the installed PEAR package
%>pear List
2. Learn more about the installed PEAR pack
%>pear Info Package Name
3. Install PEAR Package
Syntax:%>pear install [options] Package
Suppose, for example, that you want to install a Auth package:%>pear Install Auth
From the execution output of the command, you can see that many packages have optional dependency packages, and if they are installed, some of the available features can be extended.
3.1, automatic installation of all dependent
Any required dependencies will be installed by default after the pear version. However, you may also want to install optional dependencies. This time, pass-A is the--alldeps option:
%>pear install-a Auth_http
3.2. Manually install a package from PEAR Web Site
The Pear Package Manager installs the latest stable version of the package by default. But if you want to install a previous version of the package, or you can't use the Package Manager at all (because there are some administrative restrictions on the shared server), you can go to pear.php.net and find the package you need. If you know the package name, add the package name directly behind the URL just now, so that's a shortcut. These packages are formatted as tgz.
Then, extract the downloaded tgz format file to the appropriate location. Creating a pear directory in the home directory is sufficient if you are forced to follow the installation process by bypassing the ISP restrictions. In any case, make sure that the directory is in Include_path.
4. Include the package into the script
Using the pear package is simple, just use include or require to make the contents of the package available to the script. Remember that you need to add the base directory of the pear to the include_path directive.
Require_once ("numbers/roman.php")
5. Upgrade Package
syntax for upgrading individual packages:%>pear upgrade [package name]. For example, sometimes you might want to upgrade the pear package that manages your package environment, so you can perform%>pear upgrade pear
Upgrade all packages:%>pear Upgrade-all. Although unlikely, it is likely that some future package versions will not be compatible with previous versions. Therefore, it is not recommended to use this command unless you are well aware of the consequences of upgrading each package.
6. Unload a Package
%>pear Uninstall [options] Package name
Example:%>pear Uninstall Numbers_roman
If there are other packages that depend on the package you want to unload, a list of these dependent packages will be output and the uninstallation will fail. can use-n is also
--nodeps option to force uninstallation, but it is not recommended because the other packages that depend on the package you uninstalled will not work properly. Therefore, you should uninstall those dependent packages first. You can unload multiple packages at once.
%>pear Uninstall Package1 Package2 Packagen
7. Downgrade PEAR Package
The package Manager is not a usable means of being able to downgrade a package. To do this, you can go to http://pear.php.net to download a satisfactory version, then uninstall the previously installed version, and then install the package you just downloaded.