PHP Debugging Tools xdebug Installation Configuration Tutorial

Source: Internet
Author: User
Tags php debugging tools php source code phpinfo zend

PHP Debugging Tools xdebug Installation Configuration Tutorial

Speaking of PHP code debugging, for experienced phper, through the Echo, Print_r, Var_dump function, or PHP development tools Zend Studio, EditPlus can solve most of the problems, but for PHP beginners to learn the children's shoes have a certain degree of difficulty, And just through these PHP debugging means, it is difficult to pinpoint the PHP performance problem, Xdebug is a very useful PHP debugging tool.

Xdebug as a PHP debugging tool, provides a rich set of debugging functions, you can also configure the Xdebug installation as Zend Studio, EditPlus debugging PHP third-party plug-in, by turning on auto-tracking (auto_trace) and analyzer functions, You can visually see the PHP source code performance data in order to optimize the PHP code. Today we share the basics of PHP Debugging Tools Xdebug installation and configuration.

The installation configuration of Xdebug in PHP involves modifications to the php.ini configuration file.

  Xdebug Installation Tutorials

  Download Xdebug

First we need to download xdebug, be sure to choose the appropriate version of Xdebug according to the version of PHP installed, because I installed PHP in the Windows environment, so choose to download the Windows version of the Xdebug2.1.0 (5.3 VC6), Download down the Xdebug file for Php_xdebug-2.1.0-5.3-vc6.dll, this is because Xdebug is installed as a PHP module in the form of configuration and use.

  xdebug Installation Tips : If you do not know the installed PHP version, you can see through the phpinfo () function, while Xdebug also provides Phpinfo output information analysis tool to help you analyze how to install Xdebug, Just copy and submit the Phpinfo output information, address: Xdebug phpinfo Information Analysis Address

  Installing Xdebug

Copy the downloaded Php_xdebug-2.1.0-5.3-vc6.dll to the ext directory in the PHP installation directory, where the C:\php\ext,ext directory is dedicated to storing PHP extension library DLL files.

  Configure PHP.ini

The last step in installing Xdebug is to configure the php.ini file, open the php.ini configuration file under the C:\php directory, and add it at the end

[Xdebug]
zend_extension= "C:/php/ext/php_xdebug-2.1.0-5.3-vc6.dll"

Finally restart the Apache server, through the Phpinfo () function, you can see


  xdebug configuration hint : PHP5.3 Previous version configuration Xdebug use Zend_extension_ts, for PHP5.3 above version, use Zend_extension.

  Reason for XDEBUG not LOADED as ZEND extension information appears

The reason for the presence of Xdebug not LOADED as ZEND extension is that it is easy to load Xdebug as a php extension when installing Xdebug because we have copied the Php\ext DLL file into the Xdebug directory. Added a php.ini file to the

Extension=php_xdebug-2.1.0-5.3-vc6.dll

This is the wrong Xdebug installation method and must be loaded in Zend mode.

This is the end of the basic installation tutorial for PHP xdebug, and we need to make some basic configuration for xdebug.

Xdebug Configuration Tutorial

After installing Xdebug, we also need to do the basic configuration of Xdebug, the default xdebug PHP function automatic tracking (auto_trace) function, the parser function is not turned on, as the need to debug PHP code, some xdebug configuration options are best to open.

Prior to this we need to create a directory of Xdebug auto-tracking and parser output files, make sure the directory is readable and writable, where I created the Xdebug\trace and Xdebug\profiler directories under D:\PHPWeb\.

Finally, complete the configuration of Xdebug in the php.ini configuration file and find

[Xdebug]
zend_extension= "C:/php/ext/php_xdebug-2.1.0-5.3-vc6.dll"

Add Xdebug configuration information after this

CodeXdebug.auto_trace=1
Xdebug.collect_params=1
Xdebug.collect_return=1
Xdebug.trace_output_dir= "D:/phpweb/xdebug/trace"
Xdebug.profiler_enable=1
Xdebug.profiler_output_dir= "D:/phpweb/xdebug/profiler"

Finally save the php.ini and restart the Aapche server.

Xdebug section configuration Options Description

  Xdebug.auto_trace = 1

Whether to allow Xdebug trace function calls, trace information is stored as a file, the default value is 0

  Collect_params = 1

Whether the Xdebug trace function parameter is allowed, the default value is 0

  Xdebug.collect_return = 1

Whether the Xdebug trace function return value is allowed, the default value is 0

  xdebug.profiler_enable = 1

Open Xdebug Performance Analyzer, stored as a file, this configuration cannot be configured with the Ini_set () function, the default value is 0

  Xdebug.profiler_output_dir

Where the profiling file is stored, the default value is/tmp

  Xdebug.profiler_output_name

A naming convention for profiling files, with a default value of cachegrind.out.%p

  Xdebug.trace_output_dir

function call trace information output file directory, default value is/tmp

  Xdebug.trace_output_name

function call trace information output file naming convention, default is trace.%c

  Special Note : Xdebug's Trace and Profiler's output file name rules can be changed, such as the name of the file named for the specific tracking php execution file name, process ID, random number, etc., very convenient, more xdebug configuration options description, Please refer to the XDEBUG configuration option Description on the official website.

At this point, the installation and configuration of the PHP debugging tool xdebug Tutorial Xdebug is finished, and the Xdebug How to configure it in Zend Studio and EditPlus will be introduced in the future.

Excerpt from: http://www.leapsoul.cn/?p=935

Personal Configuration Backup:

[XDebug]
zend_extension= "D:\php\xampp\php\ext\php_xdebug.dll"
Xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
Xdebug.remote_handler=dbgp

PHP Debugging Tools xdebug Installation Configuration Tutorial

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.