1. Pear Introduction
pear:php Extension and Application repository,php extensions and application libraries. (Suddenly want to eat pears) Pear's Mission: To provide reusable components to lead the innovation of PHP. Provides packages and applications for PHP code. Pear is also the PHP code standard, making PHP code easy to read and improve reusability.
2. Pear Installation
When you install PHP, pear is installed by default, in the Bin directory. View the version number by using the versions parameter.
$./pear version
pear version:1.9.4
PHP version:5.4.26
Zend Engine version:2.4.0
Verify that the extensions for PHP include path pear are installed under PHP's include path.
$./pear config-get Php_dir
/home/gang/php/lib/php
3. Pear Parameters
Run directly pear will output its arguments
$./pear
Commands: Build builds a Extension from C Source
bundle unpacks a Pecl Package
Channel-add Add a channel
channel-alias Specify an alias to a channel name
channel-delete Remove A Channel from the List
...
Common parameters: Info View package Information Install installation package Uninstall Uninstall Package List view locally installed packages Remote-list View the packages on the line
Upgrade Upgrade Package Config-show View config configuration
Using Help to view common parameter usage
$./pear Help Install
4. Install PHP package
Like we're going to install log logs.
$./pear Install LOG
After successful operation, the log.php and log directories are generated in the Php/lib directory, and the doc directory is used under Doc/log for examples and instructions.
Upgrade Log Package:
./pear Upgrade LOG
5. Use of installation package
In the above we install the log package. In the application of the PHP code require come in.
Log ("Log entry $i");
}
6. Commonly used PHP packages
phpdoc– Document Extraction Tool
phpunit– Unit Test Framework
db– Database Encapsulation
All can be viewed by using the command:
$./pear remote-list