Download the URL of the source package
Http://pecl.php.net/package/xhprof
It says that each version applies to the PHP version.
Planning (pre-figuring out the idea)
One, this is the form of a PHP extension. Our installation of Gd2,curl is a form of PHP extension. It's just that sometimes when you compile it, it's installed.
Like operating the MySQL database, it is also an extension of mysql.so such that the extension can be called mysql_query () these functions.
To operate the Oracle database, a corresponding Oracle extension is added to the PHP engine.
Now, add the xhprof extension to PHP.
It's been a long time since I installed the extension with Phpize. I forgot about it myself. So go back to their blog to find the previous articles to review.
Http://www.cnblogs.com/wangtao_20/archive/2011/03/16/1986508.html
PS: I am also thinking, how this thing is so easy to forget. I only know his role. But he did not remember the steps of his operation at all. The details to be aware of.
Look, I have to find a way to understand it in a popular manner.
Ii. php.ini items that need to be configured
[Xhprof]
extension=xhprof.so;
; Directory used by default implementation of the Ixhprofruns
; Interface (namely, the Xhprofruns_default Class) for storing
; Xhprof runs.
;
; xhprof.output_dir=
; stores the default directory for xhprof running data
Xhprof.output_dir=/tmp/xhprof
Third, with this extension, you can call this extended built-in function in your PHP code to do performance monitoring, like this
Xhprof_enable (xhprof_flags_cpu + xhprof_flags_memory);
................ This is the code block to be monitored.
$data = Xhprof_disable ();
Include_once "xhprof_lib/utils/xhprof_lib.php";
Include_once "xhprof_lib/utils/xhprof_runs.php";
$objXhprofRun = new Xhprofruns_default ();//data is saved in php.ini xhprof.output_dir set directory
$run _id = $objXhprofRun->save_run ($data, "test");
=====================================================
Several extension functions are as follows
Step implementation
1, first find my server PHP installation directory, Phpize is generally in the installation directory, as follows:
/usr/local/php/bin/phpize
2, find out which directory Php-config (the following will be used), my server in:
/usr/local/php/bin/php-config
Purpose: This file is used when compiling below
./configure--with-php-config=/usr/local/php/bin/php-config
3, Find my server PHP extension in which directory, not sure, I think go to php.ini can also see, as follows
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/" This path feels a bit long. Instead of changing the settings in the php.ini, I don't feel the need at the moment (business and time costs, which is not a constraint). Expand by the original continuation.
Now know that the extension directory is:/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
In other words, I'm going to unzip the Xhprof source package into this directory (a new folder will be generated after the decompression).
Then I'm going to run phpize in this directory (so it's easy to generate configure files under this directory),
Phpize Features: Running phpize under a directory will generate configure in the A directory.
Get the above path, Shell command practice
cd/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
Unzip the downloaded Xhprof compressed package (I did not download it through wget, I was to upload this compression directly to the no-debug-non-zts-20060613 directory via FTP).
Tar zxf xhprof-0.9.3.tgz #解压后, inside there is a extension folder, into the inside (the purpose is to go inside to run phpize), the directory structure after decompression is as follows
CD xhprof-0.9.3/extension/#切换到这个扩展的源码目录去
Running phpize under this directory will generate a configure file in the extension directory (this is the mechanism of phpize)
/usr/local/php/bin/phpize
To see the extended directory, you will find that a configure file has been generated in the extension directory. Run it
======================================
./configure--with-php-config=/usr/local/php/bin/php-config #用到了前面找到的php-config file.
Make && make install
Make Test
======================================