CentOS installs PHP performance test tools with Yum Xhprof

Source: Internet
Author: User

1. First we install the XHPROF:

Yum Install Xhprof


2. After installation, find xhprof configuration file xhprof.conf, usually in/ETC/PHP.D, add these 2 lines:

Extension=xhprof.soxhprof.output_dir=<directory_for_storing_xhprof_runs>

<directory_for_storing_xhprof_runs> This path refers to the folder where the generated data is placed, for example, in/var/www/html/xhprof_data


3. If you want a graphics session, you need to install dot ( optional ):

Yum Install Graphviz


4. Reboot the server after installation:

Service httpd Restart


5. Use as long as the following file code is included:

#在php的头部加上, you can set the recording frequency, such as record one of the xhprof_enable (xhprof_flags_cpu + xhprof_flags_memory);
#在代码页的底部加上if ($xhprof _flag) {$xhprof _data = xhprof_disable ();    Include_once "./xhprof_lib/utils/xhprof_lib.php";    Include_once "./xhprof_lib/utils/xhprof_runs.php";    $xhprof _runs = new Xhprofruns_default (); $xhprof _runs->save_run ($xhprof _data, ' xhprof ', "index_". Time ());

above the xhprof_lib,php and xhprof_runs.php the path of the 2 files to change to their own path, do not write wrong, if you cannot find these two files, you can use the command Whereis xhprof This instruction will list the xhprof related paths, and you can query them all. ?


6. Copy the xhprof_html folder to the root of your Web server to access the generated files, and when the PHP is accessed, the <directory_for_storing_xhprof_runs> A index_1277956324.xhprof-like record file is generated under the directory, and the results are visible using a similar http://www.url.com/xhprof_html/index.php?run=index_1277956324. You can also http://www.url.com/xhprof_html/index.php access the file directory and select any one to view it.

CentOS installs PHP performance test tools with Yum Xhprof

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.