Home  >  Article  >  Backend Development  >  Using the PEAR package manager

Using the PEAR package manager

WBOY
WBOYOriginal
2016-08-08 09:19:001098browse

Through the PEAR package manager, you can browse and search for contributed packages, view the latest releases, and download these packages. The syntax for executing it on the command line is as follows: %>pear [options] command [command-options]

Open a command line prompt and execute %>pear, which will output a set of common commands and some usages information.

%>pear help You can query the help for a certain command.

1. View the installed PEAR package

%>pear list

2. Learn more about the installed PEAR package

%>pear info package name

3. Install the PEAR package

Syntax: %>pear install [options] package

Suppose, for example, you want to install an Auth package: %>pear install Auth

From the execution output of the command, you can see that many packages have some optional dependencies Packages, if installed, will extend some of the available features.

3.1, automatically install all dependencies

Later PEAR versions will install any necessary dependencies by default. However, you may also want to install optional dependencies. At this time, pass -a which 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 cannot use the package manager at all (because of some management restrictions on the shared server), then you can go to pear.php.net and find what you need package. If you know the package name, just add the package name to the end of the URL just now, which is a shortcut. The format of these packages is tgz.

Then, extract the downloaded tgz format file to the appropriate location. If you are forced to follow this installation process because you want to bypass ISP restrictions, then creating a PEAR directory in your home directory will suffice. Regardless, make sure the directory is in include_path.

4. Include the package into the script

Using the PEAR package is very simple, just use include or require to make the package content available to the script. Remember, PEAR's base directory needs to be added to the include_path directive.

require_once("Numbers/Roman.php")

The above introduces the use of PEAR package manager, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn