Installation environment
You must configure and install the PHP environment before installing PEAR.
(Directly access the http://go-pear.org and save its home page as a go-pear.php)
PEAR installation preparation
If the PHP runtime environment does not contain pearles, The go-pear.php file will be downloaded and stored in the directory where php.exe is located.
PEAR Installation Steps
1. Here I use the wamp integration environment, d: \ wamp \ bin \ php \ php5.2.5> go-pear, and start automatic installation.
Through this PEAR installation, we can see that the installation directory structure of PEAR needs to be confirmed first, and the system can automatically identify it.
2. Confirm the installation directory structure of PEAR in Windows, press enter, start to download and install the default extension package of PEAR, you can also choose whether to install Pear_Frontend_Web-beta, Pear_Frontend_Gtk2, MDB2 extension package at the same time.
3. After the default PEAR extension package is installed, the system prompts whether to configure php. the include_path option in the INI file points to the installation directory of pear. Of course, you need to configure it. Otherwise, you cannot use it. Press Y and press Enter. The installation package automatically modifies the include_path option.
PEAR installation is complete. Double-click PEAR_ENV.reg to import relevant information to the Registry and restart Apache.
Other PEAR installation methods
If the PHP runtime environment comes with PEAR, you can find the PEAR. DAT file in the PHP Directory and double-click the file to install PEAR. The installation method is similar to the preceding method. Also, modify the include_path option in PHP. INI.
PEAR command
In the command line mode, you can use PEAR-related commands to install the PEAR installation package you need.
Pear help lists all pear commands, similar to the pear command help command.
Pear help <command> lists the details of a pear command.
Pear help shortcuts short for listing all pear commands
Pear list-all lists all the packages that can be installed. You can access the pear extension package list to find the required packages, and then run the pear install command to install the packages.
(When installing pear, you can set it to the default value and press enter all the time .)
Then install the unit test framework phpunit:
D: \ wamp \ bin \ php \ php5.2.5> pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
D: \ wamp \ bin \ php \ php5.2.5> pear install phpunit/PHPUnit
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, channel :/
/Pear.symfony-project.com/YAML, use -- alldeps to download automatically
Phpunit/PHPUnit requires PEAR Installer (version> = 1.8.1), installed version is
1.6.1
Phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >=1.2
. 1)
Phpunit/PHPUnit can optionally use package "pear/Log"
Phpunit/PHPUnit can optionally use package "channel: // pear.symfony-project.com/Y
AML "(version> = 1.0.2)
Phpunit/PHPUnit can optionally use PHP extension "pdo_sqlite"
Phpunit/PHPUnit can optionally use PHP extension "soap"
Phpunit/PHPUnit can optionally use PHP extension "xdebug" (version> = 2.0.5)
No valid packages found
Install failed
(Failed to install phpunit. Update pear through pear upgrade pear and continue installation)
D: \ wamp \ bin \ php \ php5.2.5> pear upgrade pear
Downloading PEAR-1.9.0.tgz...
Starting to download PEAR-1.9.0.tgz (291,634 bytes)
......
D: \ wamp \ bin \ php \ php5.2.5> pear info pear
About pear. PHP. NET/PEAR-1.9.0
......
D: \ wamp \ bin \ php \ php5.2.5> pear channel-discover pear.phpunit.de
Channel "pear.phpunit.de" is already initialized
D: \ wamp \ bin \ php \ php5.2.5> pear install phpunit/PHPUnit
Unknown remote channel: pear.symfony-project.com
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, channel :/
/Pear.symfony-project.com/YAML, use -- alldeps to download automatically
Phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >=1.2
. 1)
Phpunit/PHPUnit can optionally use package "pear/Log"
Phpunit/PHPUnit can optionally use package "channel: // pear.symfony-project.com/Y
AML "(version> = 1.0.2)
Phpunit/PHPUnit can optionally use PHP extension "pdo_sqlite"
Phpunit/PHPUnit can optionally use PHP extension "soap"
Phpunit/PHPUnit can optionally use PHP extension "xdebug" (version> = 2.0.5)
Downloading PHPUnit-3.4.13.tgz...
Starting to download PHPUnit-3.4.13.tgz (254,903 bytes)
........................................ ............. Done: 254,903 bytes
Install OK: channel: // pear.phpunit.de/PHPUnit-3.4.13
After phpunit is installed, enter phpunit for testing.