Home > Backend Development > PHP Tutorial > Detailed tutorial on using xdebug to debug php

Detailed tutorial on using xdebug to debug php

P粉547719424
Release: 2022-05-10 09:04:07
Original
205 people have browsed it

Download xdebug extension
Copy all the information in phpinfo() to the text box in Xdebug, as shown in the figure below: Click the "Analyse my phpinfo() output" button.

Detailed tutorial on using xdebug to debug php

Jump to the page as shown below, the php in this machine will be analyzed, click "Download php_xdebug-2.7.2-7.2-vc15-x86_64.dll" button to download the Xdebug extension.

Detailed tutorial on using xdebug to debug php

Configure Xdebug extension
Copy the downloaded Xdebug extension to the ext folder in the php directory, and add the following configuration information at the end of the php.ini configuration :

zend_extension=E:\php7\ext\php_xdebug-2.7.2-7.2-vc15-x86_64.dllxdebug.profiler_output_dir="E:\php\xdebug"xdebug.trace_output_dir="E:\php\xdebug"xdebug.remote_port=9000xdebug.idekey=PHPSTORMxdebug.remote_autostart=1xdebug.remote_host=localhostxdebug.remote_enable=1
Copy after login

Then restart the service and open phpinfo() again. The xdebug extension appears to indicate that the configuration is successful

Detailed tutorial on using xdebug to debug php

Configure Xdebug in phpStorm
In commonly used editors Configure xdebug in the server, taking phpstorm as an example, open "File->Settings->Languages ​​& Development->PHP->Debug" and configure the XDebug listening port number, which needs to be the same as that configured in the php.ini configuration file The port number remains consistent, as shown in the following figure:

Detailed tutorial on using xdebug to debug php

##Open "File->Settings->Languages ​​& Development->PHP->Debug->DBGp Proxy", configure the DBGp protocol configuration information, as shown in the following figure:

Detailed tutorial on using xdebug to debug php

Open "File->Settings->Languages ​​& Development->PHP->Server ", configure the php run server, as shown in the following figure:

Detailed tutorial on using xdebug to debug php

Open "Run/Debug Configurations" and add "PHP Web Page", as shown in the following figure:

Detailed tutorial on using xdebug to debug php

Chrome adds Xdebug helper extension

After Chrome adds the Xdebug helper extension, you need to configure the "IDE key", which needs to be configured with php.ini The configuration in the file remains consistent. The above configuration file is written as PHPSTORM

Detailed tutorial on using xdebug to debug php##Enable phpStorm debugging

First set the running server to localhost, then turn on php debug monitoring, run debug mode, and finally set breakpoints. As shown in the picture below:


Detailed tutorial on using xdebug to debug php#The above is the entire content of this article, I hope it can be helpful to everyone.

The above is the detailed content of Detailed tutorial on using xdebug to debug php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template