Home  >  Article  >  Backend Development  >  How to implement remote debugging using phpstorm and xdebug, phpstormxdebug_PHP tutorial

How to implement remote debugging using phpstorm and xdebug, phpstormxdebug_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:02:00818browse

Use phpstorm and xdebug to achieve remote debugging. phpstormxdebug

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, and the IDE will receive it after receiving it. When debugging information, you can send single-step run, stop running, run and other commands to xdebug. In this way, the powerful debugging function of vs is realized.

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. Steps: Download xdebug first, please download the xdebug corresponding to your php version on the official website

If you don’t know your version, please echo phpinfo(); haha, and then copy the entire page to the box of http://xdebug.org/wizard.php, 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 extension folder of php. My name is D:xamppphpext

Then configure php.ini and add this at the end:

[xdebug]
zend_extension = D:\xampp\php\ext\php_xdebug-2.2.0-5.3-vc9.dll
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=phpstorm4
xdebug.remote_autostart=1

Explain, the first line is to load xdebug, romote_enable is to enable remote debugging, the following are the parameters of remote debugging, ip, port, identification 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,

Select editconfig and configure it like this:

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 save it. This is configured.

4. Usage: Now we can start debugging.

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

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

Articles you may be interested in:

  • Analysis of phpstorm xdebug remote breakpoint debugging
  • phpstorm configuration Xdebug for debugging PHP tutorial
  • Teach you how to use PHPStorm Configuring Xdebug
  • A brief discussion on php phpStorm xdebug configuration method

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1086656.htmlTechArticleHow to use phpstorm and xdebug to achieve remote debugging. The breakpoint debugging function of phpstormxdebug vs is very powerful. Is it possible? Check whether all variables are present. PHP debugging is very troublesome, echo,...
Statement:
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