Home > Backend Development > PHP Tutorial > How to implement remote debugging using phpstorm and xdebug

How to implement remote debugging using phpstorm and xdebug

WBOY
Release: 2016-07-29 09:08:20
Original
975 people have browsed it

VS’s breakpoint debugging function is very powerful and can view all variables. PHP debugging is very troublesome, and writing echo and var_dump will make you want to vomit. Want to experience the pleasure of IDE debugging? Then let’s use xdebug.

1. Principle: xdebug is a PHP debugging plug-in that supports remote debugging. When the PHP file is running, it can send debugging information to the remote port through the tcp protocol. When the IDE receives the debugging information, it can xdebug sends single-step, abort, run and other commands. In this way, powerful debugging functions like vs can be achieved.

2. What you need: an IDE that supports xdebug remote debugging. Here we use phpstorm, which is a very powerful phpide. In addition, you need a version of xdebug corresponding to your php.

3. Step: Download xdebug first, please download the xdebug corresponding to your php version on the official website

How to implement remote debugging using phpstorm and xdebug

If you don’t know your version, please echo phpinfo(); haha, and then copy the entire page to http ://xdebug.org/wizard.php in the box on this page, and then it will automatically analyze your php version, and then tell you which folder to put it in. We can just put it in the php expansion folder. I am D ; String, automatic remote debugging.

Then restart apache, and xdebug will be loaded successfully. The Shenma website will be much slower because you have enabled automatic remote debugging, and each visit will connect to the defined IP and port. Ha ha. It's up to you to decide.

Then it’s time to configure the IDE,

How to implement remote debugging using phpstorm and xdebug

select editconfig, and then configure it like this:

How to implement remote debugging using phpstorm and xdebug

Configure the server 127.0.0.1 80 xdebug in php remote debug, and then set the identification string. Here is the phpstorm4 we have defined and then save it. This is all configured.

4. Usage: Now we can start debugging.

How to implement remote debugging using phpstorm and xdebug

Click the button to start monitoring remote debugging. When it turns green, it means the monitoring is successful. Next we set a breakpoint.

How to implement remote debugging using phpstorm and xdebug

See Muyou, Youmuyouyoumuyou is very powerful and can be executed step by step. F7 single-steps into the function, and F8 is a single-step skip function. There are messages that I don’t understand.

The above introduces the method of using phpstorm and xdebug to implement remote debugging, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

How to implement remote debugging using phpstorm and xdebug

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template