PHP Performance Optimization Tool –XHPROF installation, here I first post the approximate steps:
1. Get Xhprof
2. Pre-compilation Pre-processing
3. Compiling the installation
4. Configure PHP.ini
5. View running Results
So let's start by installing the Xhprof tool:
1. Get Xhprof
You can enter the URL to download directly, or wget
1234 |
#wget http://pecl.php.net/get/xhprof-0.9.4.tgz #tar zxf xhprof-0.9.4.tgz |
2. Pre-compilation Pre-processing
Before compiling the xhprof, do preprocessing, generate configure file;
12345 |
#cd xhprof-0.9.4 #cd Extension #phpize |
Phpize doesn't have this command.
Used to extend the PHP extension module
Phpize is a content that belongs to Php-devel, so just run
Yum install Php-devel on the line.
Command: Yum install php-devel-y
Location:/usr/bin/phpize
3. Compiling the installation
#./configure–with-php-config=/usr/bin/php-config
#make && make Install
Installation Successful
4. Configure PHP.ini
Appended to the PHP configuration file, Xhprof extension, php.ini
12345 |
& nbsp [xhprof] extension=xhprof.so xhprof. Output_dir=/usr/< Span class= "crayon-v" >share/nginx/html/tmp/ xhprof |
Note: If the 64-bit system needs to copy the xhprof.so file to the/lib64 directory
123 |
#cp/usr/lib64/php/modules/xhprof.so/lib64/ |
5. View running Results
Copy the instance to your Web directory for an example demo:
123 |
#cp-R examples xhprof_html xhprof_lib/usr/share/nginx/html/xhprof |
A. Run the instance to see the effect, in the browser input
http://localhost/xhprof/examples/sample.php
B. Copy the above to run to the result (HTTP path), put in the browser again, fill in the previous corresponding domain name:
Http://localhost/xhprof/xhprof_html/index.php?run=5307089e3e0fe&source=xhprof_foos
To view the results, correct:
If the input browser has no data
This situation: Run #530707980ee18: Invalid run Id = 530707980ee18
Error Result:
May be your configuration permissions are insufficient, please give a permission, you can directly 777, and then rerun the walk after this step to see the effect.
Here Xhprof installation is over, start your performance optimization trip, with this tool will be more effective ~ ~
For Xhprof's noun explanation:
12345678910111213141516171819202122 |
function name function name number of Calls calls Calls% call percentage incl. Wall time (microsec) calls include child functions all spend a microsecond count (one out of 10,000 seconds ) IWall% of all elapsed time inclusive child functions called Excl. Wall time (microsec) function execution itself, excluding subtree execution time , in microseconds (one out of 10,000 seconds ) Ewall% of the time spent by the function execution itself, excluding subtree execution time incl. CPU(microsecs) calls include all the CPU time spent by the child functions . Minus incl. Wall time is waiting for the CPU ReducingExcl. Wall time is waiting for the CPU icpu% incl. percent of CPU (microsecs) Excl. the CPU (microsec) function executes its own CPU time, excluding subtree execution time , in microseconds (one out of 10,000 seconds ). ecpu% Excl. percent of CPU (microsec) incl. Memuse(bytes) includes the memory used by the child function execution. imemuse% incl. Percentage of memuse (bytes) Excl. The Memuse(bytes) function executes its own memory , measured in bytes ememuse% Excl. Percentage of memuse (bytes) incl. Peakmemuse(bytes) incl. Peak of Memuse ipeakmemuse% incl. Peak percentage of peakmemuse (bytes) Excl. Peakmemuse(bytes) Excl. Peak of Memuse epeakmemuse% ememuse% Peak percentage |
PHP Performance optimization Tool –XHPROF installation