: This article describes how to install and use the pear Library. For more information about PHP tutorials, see. Pear is a PHP extension and application library. it contains many useful classes. after php5.0 is installed, pear is not actually installed. the installation method is as follows:
1. double-click the go-pear.bat in the php directory.
2. enter some settings as Prompted. add the LAN gateway, for example, http: // 192.168.0.1: 80/. pear needs to use this address to access the Internet. if there is no proxy server, press enter.
3. you will be prompted to bind some packages to PHP and select Y.
4. install the basic package and prompt that the installation is successful.
5. open the php. ini file in the windows directory and find the following:
; UNIX: "/path1:/path2"
; Include_path = ".:/php/shortdes"
; Windows: "\ path1; \ path2"
; Include_path = ".; c: \ php \ shortdes"
Remove the comment from the last line and change the following path to your PEAR path, for example:
Export de_path = ".; c: \ php \ pear \"
Save PHP. INI and restart APACHE.
---------------
Pear command help
---------------
You can find the pear. php file in your PEAR Directory. this is the command for managing pear, which is used in CMD. Some of its command functions are as follows:
Security Protection:
A pear program running on the web server:
Pear install packagename
The following packages are not supported:
Pear download packagename
Pear download-all
The package of the specified region is as follows:
Pear install filename. tgz
List:
Currently, all pear program regions can be obtained on the pear website:
Pear remote-list
List installed packages:
Pear list
List packages that can be upgraded:
Pear list-upgrades
Update (upgrade ):
Update package:
Pear upgrade packagename
Pear upgrade-all
Remove:
Remove the installed package:
Pear uninstall packagename
----------------
Install a new package
----------------
For example, you downloaded the new package xxx.tgzfrom http://pear.php.net/package.
Copy it to the C: \ PHP \ PEAR \ go-pear-bundle directory and enter:
Pear install xxx. tgz
Then, extract the related files to the directory C: \ PHP \ PEAR.
---------------
Instance
---------------
Download the PEAR: HTML_Common and PEAR: HTML_QuickForm packages and install them.
Create a new php file and enter the code
PEAR: HTML_QuickForm
Require_once ("HTML \ QuickForm. php ");
// Create a form object
$ Form = new HTML_QuickForm ('frmtest', 'post ');
$ Form-> addElement ('header', 'header', 'login ');
$ Form-> addElement ('text', 'name', 'username :');
$ Form-> addElement ('password', 'password', 'password :');
$ Form-> addElement ('submit ', 'submit', 'submit ');
// Output to the browser
$ Form-> display ();
?>
The above describes the installation and use of the pear library, including the content, and hope to be helpful to friends who are interested in the PHP Tutorial.