


Detailed explanation of PHP XDebug configuration and installation method_PHP tutorial
XDebug is a debugging tool for PHP. We can use echo, print, etc. to call errors, but our functions cannot check the number of function executions and execution time. This can be achieved using XDebug. Let me introduce the configuration and installation process of php XDebug in winodws.
We first go to the official website to download php_xdebug.dll, 2. Place the downloaded php_xdebug.dll in the PHP installation directory phpext, and then edit the php.ini file
The code is as follows | Copy code | ||||
zend_extension = "/home/ad/php/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so" xdebug.auto_trace = on xdebug.auto_profile = on xdebug.collect_params = on xdebug.collect_return = on xdebug.profiler_enable = on xdebug.trace_output_dir = "/home/ad/xdebug_log" xdebug.profiler_output_dir = "/home/ad/xdebug_log" |
4. Restart Apache.
5. Write a test.php with the content of . If xdebug is seen in the output content, the installation and configuration are successful. Or go to /home/ad/xdebug_log to see if the log has come out.
PHP Xdebug configuration information
Explanation of some Xdebug configuration options
xdebug.auto_trace = 1
Whether to allow Xdebug to trace function calls. The tracking information is stored in a file. The default value is 0
collect_params = 1
Whether to allow Xdebug to track function parameters, the default value is 0
xdebug.collect_return = 1
Whether to allow Xdebug to track function return values, the default value is 0
xdebug.profiler_enable = 1
Open the xdebug performance analyzer and store it in file form. This configuration cannot be configured with the ini_set() function. The default value is 0
xdebug.profiler_output_dir
The storage location of the performance analysis file. The default value is /tmp
xdebug.profiler_output_name
Naming rules for performance analysis files, the default value is cachegrind.out.%p
xdebug.trace_output_dir
Function call tracking information output file directory, the default value is /tmp
xdebug.trace_output_name
Function call trace information output file naming rules, the default is trace.%c
Setting Options
Category | Setting | Description |
---|---|---|
Log |
xdebug.trace_output_dir |
Log tracking output directory |
xdebug.trace_output_name | Log file name, xdebug provides a series of identifiers to generate file names in corresponding formats. For details, please refer to the official website | |
xdebug.trace_options | How records are added to the file: 1 = Append (if the file exists). 0 (default) = Overwrite (if the file exists) | |
Show data | xdebug.collect_params | Non-zero value = Controls the parameter display options of the function
|
xdebug.collect_return | 1 = Display function return value. Default 0 does not display | |
xdebug.collect_vars | 1 = Show which variables are used in the current scope and display the variable name. This option will not record the value of the variable. If necessary, use xdebug.collect_params | |
xdebug.collect_assignments | 1 = Add a line to display variable assignment (if it is 1, it will be in the form $a = 1; this type of Assignment Expression will be displayed in the trace file) | |
Format | xdebug.trace_format |
|
xdebug.show_mem_delta | 1 = Display memory consumption (memory difference) of each function call | |
Behavior | xdebug.auto_trace | 1 = Turn on automatic tracking. (There are two tracking methods, one is automatic tracking, all php scripts will generate trace files when running; the other is triggered tracking, as follows) |
xdebug.trace_enable_trigger[2] |
1 = Use XDEBUG_TRACE GET/POST to trigger tracing, or set the cookie XDEBUG_TRACE. To avoid generating corresponding trace files for each request, you need to set auto_trace to 0 Note: This feature can only be set in version 2.2+ |
|
Restrictions | xdebug.var_display_max_depth | Display depth of array and object elements: Mainly used when nesting arrays and object attributes to display several levels of element content. Default 3. |
xdebug.var_display_max_data | How long to display when the variable value is a string. Default 512. | |
xdebug.var_display_max_children | The number of array and object elements displayed. Default 128 |
Some custom functions
Function | Description |
---|---|
void xdebug_enable() | 手动打开,相当于xdebug.default_enable=on |
void var_dump() | 覆写php提供的var_dump,出错时,显示函数堆栈信息,(前提:php.ini里html_errors为1),使用xdebug.overload_var_dump 设置是否覆写 |
void xdebug_start_trace( string trace_file_path [, integer options] ) |
手动控制需要追踪的代码段 trace_file_path :文件路径(相对或绝对,若为空).如果为空,或者不传参, 使用xdebug.trace_output_dir设置的目录 options :
|
void xdebug_stop_trace() | 停止追踪,代码追踪在该行停止 |
string xdebug_get_tracefile_name() | 获得输出文件名,与 xdebug.auto_trace配合使用. |
void xdebug_var_dump([mixed var[,...]]) | 输出变量详细信息,相当于php里的var_dump,具体显示请看这里 |
xdebug.show_local_vars | 默认为0,不显示;非零时,在php执行出错时,显示出错代码所在作用域所有本地变量(注:这会产生大量信息,因此默认是closed),具体显示差别如下图[3] |
array xdebug_get_declared_vars() | 显示当前作用域中已声明的变量 |
array xdebug_get_code_coverage() | 显示某一段代码内,代码执行到哪些行[4] |
trace_file_path: file path (relative or absolute, if empty). If it is empty, or no parameters are passed, use the directory set by xdebug.trace_output_dir options:
- XDEBUG_TRACE_APPEND: 1 = append to the end of the file content, 0 = overwrite the file
- XDEBUG_TRACE_COMPUTERIZED:
- 2 =Same as xdebug.trace_format=1.
- XDEBUG_TRACE_HTML: 4 = Output an HTML table and open it as a table in the browser

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main differences between Laravel and Yii are design concepts, functional characteristics and usage scenarios. 1.Laravel focuses on the simplicity and pleasure of development, and provides rich functions such as EloquentORM and Artisan tools, suitable for rapid development and beginners. 2.Yii emphasizes performance and efficiency, is suitable for high-load applications, and provides efficient ActiveRecord and cache systems, but has a steep learning curve.

With the popularization and development of digital currency, more and more people are beginning to pay attention to and use digital currency apps. These applications provide users with a convenient way to manage and trade digital assets. So, what kind of software is a digital currency app? Let us have an in-depth understanding and take stock of the top ten digital currency apps in the world.

The built-in quantization tools on the exchange include: 1. Binance: Provides Binance Futures quantitative module, low handling fees, and supports AI-assisted transactions. 2. OKX (Ouyi): Supports multi-account management and intelligent order routing, and provides institutional-level risk control. The independent quantitative strategy platforms include: 3. 3Commas: drag-and-drop strategy generator, suitable for multi-platform hedging arbitrage. 4. Quadency: Professional-level algorithm strategy library, supporting customized risk thresholds. 5. Pionex: Built-in 16 preset strategy, low transaction fee. Vertical domain tools include: 6. Cryptohopper: cloud-based quantitative platform, supporting 150 technical indicators. 7. Bitsgap:

Integrating Sentry and Bugsnag in Laravel can improve application stability and performance. 1. Add SentrySDK in composer.json. 2. Add Sentry service provider in config/app.php. 3. Configure SentryDSN in the .env file. 4. Add Sentry error report in App\Exceptions\Handler.php. 5. Use Sentry to catch and report exceptions and add additional context information. 6. Add Bugsnag error report in App\Exceptions\Handler.php. 7. Use Bugsnag monitoring

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

This groundbreaking development will enable financial institutions to leverage the globally recognized ISO20022 standard to automate banking processes across different blockchain ecosystems. The Ease protocol is an enterprise-level blockchain platform designed to promote widespread adoption through easy-to-use methods. It announced today that it has successfully integrated the ISO20022 messaging standard and directly incorporated it into blockchain smart contracts. This development will enable financial institutions to easily automate banking processes in different blockchain ecosystems using the globally recognized ISO20022 standard, which is replacing the Swift messaging system. These features will be tried soon on "EaseTestnet". EaseProtocolArchitectDou

Recommended cryptocurrency trading platforms include: 1. Binance: the world's largest trading volume, supports 1,400 currencies, FCA and MAS certification. 2. OKX: Strong technical strength, supports 400 currencies, approved by the Hong Kong Securities Regulatory Commission. 3. Coinbase: The largest compliance platform in the United States, suitable for beginners, SEC and FinCEN supervision. 4. Kraken: a veteran European brand, ISO 27001 certified, holds a US MSB and UK FCA license. 5. Gate.io: The most complete currency (800), low transaction fees, and obtained a license from multiple countries. 6. Huobi Global: an old platform that provides a variety of services, and holds Japanese FSA and Hong Kong TCSP licenses. 7. KuCoin

Building a live chat application in Laravel requires using WebSocket and Pusher. The specific steps include: 1) Configure Pusher information in the .env file; 2) Set the broadcasting driver in the broadcasting.php file to Pusher; 3) Subscribe to the Pusher channel and listen to events using LaravelEcho; 4) Send messages through Pusher API; 5) Implement private channel and user authentication; 6) Perform performance optimization and debugging.
