Install Pear
--------------
Pear is a php extension and application library that contains a number of useful classes, and after installing php5.0, pear is not actually installed, and the installation method is as follows:
1. Double-click Go-pear.bat in the PHP directory.
2. Follow the prompts to enter a number of settings information, mainly to the LAN gateway Plus, such as http://192.168.0.1:80/, pear to use this address to access the Internet, if no proxy server then direct return
3. Then you will be prompted with some packages and PHP bindings, select Y.
4. Then install the basic package and prompt installation success, it is so simple.
5. Open the php.ini file in the Windows directory, and then find the following places:
; UNIX: "/path1:/path2"
; include_path = ".:/ Php/includes "
;
; Windows: "Path1;path2"
; include_path = ".; C:phpincludes "
Remove the comment from the last line and change the path back to your pear path, for example:
include_path = ".; C:phppear "
Save the php.ini, and then restart Apache.
---------------
Pear Command Help
---------------
You can find the Pear.bat file in your PHP root directory, which is the command to manage pear, used in cmd, to set the environment variable path, or double-click the generated ev_xxx. REG file. Some of its commands function as follows:
Installation:
Install a pear library from the Internet:
Pear Install PackageName
Download packages but uneasy outfit:
Pear Download PackageName
Pear Download-all
Mounted Package:
Pear Install filename.tgz
List:
The list of all available pear repositories on the Pear Web site today:
Pear remote-list
List Mounted Package:
Pear List
List the package that can be upgraded:
Pear List-upgrades
Update (upgrade):
Update package:
Pear Upgrade PackageName
Pear Upgrade-all
Removal:
To delete an installed package:
Pear Uninstall PackageName
----------------
To install a new package
----------------
For example, you downloaded a new package from http://pear.php.net/package/xxx.tgz.
Copy it to the C:phppeargo-pear-bundle directory and enter it in CMD:
Pear Install xxx.tgz
On the line, the related files were extracted to the c:phppear corresponding directory.
---------------
Instance
---------------
Download the Pear::html_common and Pear::html_quickform packages, and then install.
Build a new PHP file, enter the code
Require_once ("htmlquickform.php");
Create a Form Object
$form = new Html_quickform (' frmtest ', ' post ');
$form->addelement (' header ', ' header ', ' please login ');
$form->addelement (' text ', ' name ', ' username: ');
$form->addelement (' Password ', ' password ', ' Password: ');
$form the->addelement (' Submit ', ' submit ', ' submit ');
Output to Browser
$form->display ();
?>
Look at the results in the browser, it is not more than you manually write code faster!