This is the first phase of the PHP performance optimization series. how to install PEAR in a Windows environment and use the Benchmark tool class as an example to explain how to install the extension class for PEAR.
What is PEAR?
PEAR is the abbreviation of the PHP Extension and Application Repository. It is a code repository for PHP extensions and applications. In short, PEAR is the CPAN of PHP.
Why is PEAR installed?
PEAR provides a wide range of PHP extension tools, which are easy to use and can be used in various projects. Benchmark is an extension package of PEAR. It provides three Tool classes: Timer, Iterate, and Profiler. it can be used for breakpoint debugging during performance optimization to obtain the code execution time.
How to install PEAR
Open the source code installed PHP root directory, such as C: \ Program Files \ php5 \ php-5.2.6 \, double-click the go-pear.bat file, the installation process is illustrated as follows
In this way, PEAR is successfully installed. basically, you only need to press Enter during the installation process, which is very simple.
How to install the Benchmark class
Visit: http://pear.php.net/search for benchmark
(1) install the Benchmark tool class using the doscommand
Enter the following command
> Pear install Benchmark-1.2.7
For example: C: \ Program Files \ php5 \ php-5.2.6> pear install Benchmark-1.2.7
Directly access the PEAR directory after installation, such as C: \ Program Files \ php5 \ php-5.2.6 \ PEAR
(2) directly download the Benchmark tool file
: Http://pear.php.net/package/Benchmark/download
Benchmark: http://download.pear.php.net/package/Benchmark-1.2.7.tgz
Directly download and unzip the PEAR Directory, such as C: \ Program Files \ php5 \ php-5.2.6 \ PEAR
Here we will only discuss PEAR installation, and use the Benchmark toolkit as an example to discuss how to use PEAR to download and install the tool package. In the next issue, we will discuss how to use the Benchmark tool to obtain the code execution time and the average function execution time.
Other instructions
What is CPAN?
CPAN is a huge extension module repository of PERL. the application modules written can be placed under the appropriate classification directory under CPAN. other people can reuse them conveniently. of course, you also need to follow the rules when writing the application module.
References
PEAR http://pear.php.net/
PEAR introduction: Use PEAR to write your next php program