Home Backend Development PHP Tutorial php xdebug installation configuration and debugging php skills_PHP tutorial

php xdebug installation configuration and debugging php skills_PHP tutorial

Jul 13, 2016 pm 05:08 PM
php xdebug and code Can it Install tool implement Skill yes debug Configuration high

xdebug is a high-level tool for PHP code execution. It can very well test the performance of each stage of our PHP code, so that we can optimize the code in a timely manner. Now I will give you the configuration of xdebug and xdebug debugging skills. .

windows xdebug configuration installation

1. Download Xdebug

Download address: http://xdebug.org/download.php
The latest version is 2.1.2. There are many versions, including the difference between 32-bit and 64-bit, the difference between VC6 and VC9, and the difference between thread safety and not


Save to test.php, and open the saved server directory through the browser. Find Compiler (if not, it is VC6), Architecture (if not, look at the value of Configure Command) and Thread Safety in the front Info. As shown below, you should download 32-bit VC9 thread-safe (PHP 5.3 VC9 TS (32 bit))

2. Install Xdebug
If you have already configured PHP, rename the downloaded file to php_xdebug.dll (it doesn’t matter if you don’t change it, just to look better), and put down the ext folder in the PHP installation directory.

3. Configure Xdebug

Xdebug has many configuration items, and I only know a few of them, so I will only talk about the commonly used ones. Modify the php.ini file in the PHP installation directory and insert the following code at the end of the file:
[Xdebug]

The code is as follows Copy code
 代码如下 复制代码

zend_extension="E:APMServPHPextphp_xdebug.dll"

xdebug.auto_trace=On
;自动跟踪设置最好在最前面设置,要不然不会开启

xdebug.profiler_enable=on

xdebug.trace_output_dir="E:APMServxdebug"

xdebug.profiler_output_dir="E:APMServxdebug"

;最大递归数

xdebug.max_nesting_level=100

;重写var_dump()

xdebug.overload_var_dump = On

;当这个参数被设置为1时,即使捕捉到异常,xdebug仍将强制执行异常跟踪当一个异常出现时

xdebug.show_exception_trace=1

 

xdebug.show_local_vars = 1


xdebug.collect_params=On

xdebug.collect_return=On

xdebug.collect_vars=On

xdebug.dump_undefined=On

xdebug.profiler_enable_trigger=On

 

;允许远程连接

xdebug.remote_enable=true

;允许远程连接的zs IDE的ip地址      

xdebug.remote_host=192.168.0.51

;zendstudio 设定的端口

xdebug.remote_port=9000

;zendstudio 的应用层通信协议

xdebug.remote_handler=dbgp

xdebug.extended_info="1"

zend_extension="E:APMServPHPextphp_xdebug.dll"


xdebug.auto_trace=On

;It is best to set the automatic tracking setting at the front, otherwise it will not be turned on


xdebug.profiler_enable=on xdebug.trace_output_dir="E:APMServxdebug"

xdebug.profiler_output_dir="E:APMServxdebug"

;Maximum number of recursions

xdebug.max_nesting_level=100

;Rewrite var_dump()
 代码如下 复制代码

    wget http://www.xdebug.org/files/xdebug-2.2.3.tgz
    tar xzf xdebug-2.2.3.tgz
    cd xdebug-2.2.3
    /usr/bin/phpize
    ./configure --with-php-config=/usr/local/php/bin/php-config

xdebug.overload_var_dump = On ; When this parameter is set to 1, even if an exception is caught, xdebug will still force exception tracking when an exception occurs xdebug.show_exception_trace=1 xdebug.show_local_vars = 1 xdebug.collect_params=On xdebug.collect_return=On xdebug.collect_vars=On xdebug.dump_undefined=On xdebug.profiler_enable_trigger=On ;Allow remote connections xdebug.remote_enable=true ;The IP address of zs IDE that allows remote connection xdebug.remote_host=192.168.0.51 ;Port set by zendstudio xdebug.remote_port=9000 ;zendstudio’s application layer communication protocol xdebug.remote_handler=dbgp xdebug.extended_info="1"
Because I don’t want to have a Log file (because the file grows very fast, it will be one or two gigabytes in less than two days), so I commented out trace_output_dir and profiler_output_dir. It should be noted that Xdebug will not automatically create a directory, and you must ensure that the set directory is is actually there. As for the other several values, they are all default values, so they are noted out. Because they may be changed, they are listed here. Now refresh the phpinfo() page and you should be able to see the Xdebug information. linux xdebug configuration installation xdebug is a module of php that needs to be compiled and installed. I installed php using lnmp. php is installed to /usr/local/php by default, and then makes a hard link to /usr/bin Compile xdebug first
The code is as follows Copy code
wget http://www.xdebug.org/files/xdebug-2.2.3.tgz tar xzf xdebug-2.2.3.tgz cd xdebug-2.2.3 /usr/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config

Modify php.ini configuration

Add the following

;no-debug-non-zts-20090626 This folder name corresponds to the php version one-to-one
The code is as follows
 代码如下 复制代码

    ;no-debug-non-zts-20090626 这个文件夹名称和php版本是一一对应的

    zend_extension= "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

    xdebug.default_enable = On
    xdebug.show_exception_trace = On
    xdebug.show_local_vars = 1
    xdebug.max_nesting_level = 50
    xdebug.var_display_max_depth = 6

    xdebug.dump_once = On
    xdebug.dump_globals = On
    xdebug.dump_undefined = On
    xdebug.dump.REQUEST = *
    xdebug.cli_color = 2

Copy code

zend_extension= "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

xdebug.default_enable = On
xdebug.show_exception_trace = On
xdebug.show_local_vars = 1
xdebug.max_nesting_level = 50
xdebug.var_display_max_depth = 6

Restart php-fpm, write any php code with errors, refresh the browser, and you will see the error message
http://www.bkjia.com/PHPjc/629820.html
www.bkjia.com
truehttp: //www.bkjia.com/PHPjc/629820.htmlTechArticlexdebug is a high-level tool for PHP code execution. It can test the performance of each stage of our PHP code very well. In this way, we can optimize the code in a timely manner. Let me tell you...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

How to efficiently integrate Node.js or Python services under LAMP architecture? How to efficiently integrate Node.js or Python services under LAMP architecture? Apr 01, 2025 pm 02:48 PM

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

How to configure apscheduler timing task as a service on macOS? How to configure apscheduler timing task as a service on macOS? Apr 01, 2025 pm 06:09 PM

Configure the apscheduler timing task as a service on macOS platform, if you want to configure the apscheduler timing task as a service, similar to ngin...

In LangChain, how do I use AgentExecutor to replace the disabled initialize_agent function? In LangChain, how do I use AgentExecutor to replace the disabled initialize_agent function? Apr 01, 2025 pm 04:18 PM

How to replace the disabled initialize_agent function in LangChain? In the LangChain library, initialize_agent...

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

Can Python parameter annotations use strings? Can Python parameter annotations use strings? Apr 01, 2025 pm 08:39 PM

Alternative usage of Python parameter annotations In Python programming, parameter annotations are a very useful function that can help developers better understand and use functions...

How to ensure high availability of MongoDB on Debian How to ensure high availability of MongoDB on Debian Apr 02, 2025 am 07:21 AM

This article describes how to build a highly available MongoDB database on a Debian system. We will explore multiple ways to ensure data security and services continue to operate. Key strategy: ReplicaSet: ReplicaSet: Use replicasets to achieve data redundancy and automatic failover. When a master node fails, the replica set will automatically elect a new master node to ensure the continuous availability of the service. Data backup and recovery: Regularly use the mongodump command to backup the database and formulate effective recovery strategies to deal with the risk of data loss. Monitoring and Alarms: Deploy monitoring tools (such as Prometheus, Grafana) to monitor the running status of MongoDB in real time, and

PostgreSQL monitoring method under Debian PostgreSQL monitoring method under Debian Apr 02, 2025 am 07:27 AM

This article introduces a variety of methods and tools to monitor PostgreSQL databases under the Debian system, helping you to fully grasp database performance monitoring. 1. Use PostgreSQL to build-in monitoring view PostgreSQL itself provides multiple views for monitoring database activities: pg_stat_activity: displays database activities in real time, including connections, queries, transactions and other information. pg_stat_replication: Monitors replication status, especially suitable for stream replication clusters. pg_stat_database: Provides database statistics, such as database size, transaction commit/rollback times and other key indicators. 2. Use log analysis tool pgBadg

See all articles