Using Xdebug to debug and optimize PHP programs [1] _ PHP Tutorial

Source: Internet
Author: User
Use Xdebug to debug and optimize PHP programs [1]. Author: HaohappyMSN: haohappyatmsn. comBlog: blog. csdn. nethaohappy20042006-07-04 why need Debugger? Many PHP programmers use echo, print_r (), var_dump (), Author: Haohappy MSN: haohappy at msn.com Blog: http://blog.csdn.net/haohappy2004 2006-07-04 Why? Debugger?Many PHP programmers use echo, print_r (), var_dump (), and printf () for debugging. In fact, this is enough for programmers with rich development experience, during program execution, they can output the values of specific variables to determine whether the program is correctly executed, even the efficiency can be seen (of course, some time functions may need to be used ). So why do we need a special debugging program to monitor our program running? The answer to this question may be later. What is Xdebug?Xdebug is an open-source PHP program debugger (a Debug tool) that can be used to track, Debug, and analyze the running status of PHP programs. The latest version of Xdebug is xdebug 2.0.0beta6 and supports PHP4/PHP5. Official site: www.Xdebug.org How to install Xdebug ?Take PHP5.1.4 and Windows as an example (for other PHP versions, see the official website for other platforms): 1. log on to www.xdebug.org, there is a Windows modules on the right of the home page, select PHP5.1.2 +, download the php_xdebug-5.1.2-2.0.0beta6.dll file; 2. put the downloaded php_xdebug-5.1.2-2.0.0beta6.dll in the C: \ php5 \ ext directory and rename it php_xdebug.dll; 3. edit php. ini, add the following lines: extension = php_xdebug.dll [Xdebug] xdebug. profiler_enable = onxdebug. trace_output_dir = "I: \ Projects \ xdebug" xdebug. profiler_output_dir = "I: \ Projects \ xdebug" Ebug "you can set the Directory of the data file output by Xdebug as needed. 4. restart Apache. 5. write a test. php file with the following content: If xdebug is displayed in the output, the installation and configuration are successful. Now we can start using Xdebug Powerful functions!

Export Haohappy MSN: haohappy at msn.com Blog: http://blog.csdn.net/haohappy2004 2006-07-04 why do you need Debugger? Many PHP programmers use echo, print_r (), var_dump (),...

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.