Windows Configuration xhprof,php Performance analysis tool

Source: Internet
Author: User
Tags apache log

Would have thought that the configuration of such a tool does not have a lot of strength, behind the discovery is completely not.

First, a small episode

The morning shows that the computer cannot display all the domain names under the virtual directory, but can open localhost and the database connection will not work. This question has haunted me for a morning. There is another problem is that the input method can not be displayed, after the download of a Baidu defender to repair the next, the morning is really not smooth.

1) initially thought is the Firefox browser fiddler plugin problem, then closes the Firefox plug-in, closes the fiddler, discovers still cannot open the website.

  

2) think it is a browser problem, open a few other browsers immediately, open in Chrome browser, still can't open, show the following error, IE also not, this is strange. Then according to the error code in Baidu and Google above search, did not find anything useful.

  

3) After the colleague reminds you can look at Apache log, see if there are traces. But the strange thing is that neither log has changed.

  

4) Open the firewall, found that all have been closed, followed by the Windows log opened, there is no problem.

  

5) Finally, the next analysis of the problem, found that in fact, can not access the domain name caused by 127.0.0.1. And then search to find a command, try it, it's all well.

  

6) A strange and strange problem appears in front of the first thing to do is to open the search engine, and then describe the problem, but many times, the beginning of the description is not the core of the problem, can only be tried constantly, the problem of analysis is more and more clear.

Afternoon install Xhprof is also a similar analysis of the problem of the process, my PHP version is 5.5.17.

Second, the Windows environment

1) The first is to download the Xhprof expansion pack, search the keyword "xhprof", immediately found the PHP official web download link, and then eggs, this Linux environment.

2) search up immediately, or smoothly found, and version there are many,Windows xhprof, plain page I like.

Third, php.ini

1) put the downloaded php_xhprof.dll into the PHP ext directory. Then open the extension

2) Last configuration log file

3) See if this extension appears in Phpinfo, well, it has already appeared.

Four, demo

1) Download the PHP-related code case for xhprof on GitHub . The directory structure is as follows, examples,xhprof_html and Xhprof_lib will be used for a moment.

2) Now open the example.php file in the examples folder, there is a string of information below.

3) Then open xhprof_html, there are several logs, this log is stored in the php.ini settings xhprof.output_dir directory.

4) Click on a log, the following form appears, which represents the content can be found on the Internet.

5) Click View Full CallGraph, this is actually I want to see the effect, filled with expectations, but there was a ruthless mistake, embarrassed.

  

6) in the online search for an article , which is said to be because there is no installation of Graphviz, the software caused, immediately to download.

  

7) thought down on it, never thought, as always, error. In that article to the config.php file configuration directory, I saw in the case code for half a day did not find this file, thought in the Fool me, then i downloaded the demo code in that blog, and really found this file, but even put this file on my side, there is no bird use. and began to search, searched the article written by foreigners , also mentioned the configuration.

  

8) finally found inspiration on the website of Stack Overflow , this website is really useful. A foreigner said:

  

9) and this file, find this function immediately Xhprof_generate_image_by_dot

$descriptorspec=Array(       //stdin is a pipe , the child would read from0 =Array("Pipe", "R"),//stdout is a pipe , the child would write to1 =Array("Pipe", "w"),//stderr is a pipe , the child would write to2 =Array("Pipe", "w")       ); $cmd= "Dot-t".$type; $process=Proc_open($cmd,$descriptorspec,$pipes, Sys_get_temp_dir (),Array(' PATH ' = =getenv(' PATH ')) );

found that the environment variable read path, the original is to configure the environment variable, I was actually configured once, but not with the system variables, embarrassed, will graphviz2.38\bin the absolute path to write up.

11) The long-awaited picture has finally appeared.

If you want to apply it to a real project, there's definitely a lot of room to change.

Demo Download:

http://download.csdn.net/detail/loneleaf1/8958017

Resources:

http://blog.snsgou.com/post-816.html Installing the PHP Performance Test tool Xhprof_0.10.3_php53_vc9.dll

Http://stackoverflow.com/questions/2930254/linux-dot-utility-with-xhprof Linux dot utility (with xhprof)

Http://www.lornajane.net/posts/2012/generating-callgraph-with-xhgui generating CallGraph with Xhgui

Windows Configuration xhprof,php Performance analysis tool

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.