The breakpoint debugging function of VS is very powerful there are wood there, can see all the variables have wood there. PHP debugging is very troublesome to have wood, echo,var_dump write you want to vomit there are wood. Want to experience the thrill of IDE debugging? Then let's use the Xdebug.
1. Principle: Xdebug is a PHP debugging plug-in, support remote debugging, that is, when the PHP file is running, through the TCP protocol, to send debugging information to the remote port, the IDE when receiving debugging information, you can send a single step to Xdebug, abort running, run and other commands. This enables a powerful debug function like that of vs.
2. What you need: An IDE that supports Xdebug remote debugging, which uses Phpstorm, a phpide that is often powerful. Also need a version of your PHP xdebug.
3. Step: Download Xdebug First, please download your PHP version corresponding to the Xdebug
If you do not know your version, please echo phpinfo (), haha, and then copy the entire page into the box http://xdebug.org/wizard.php this page, then he will automatically analyze your PHP version, and then tell you which folder to put in, We put in the PHP extension folder just fine, I'm D:\xampp\php\ext.
Then configure php.ini, add this at the end:
[xdebug]zend_extension = d:\xampp\php\ext\php_xdebug-2.2.0-5.3-vc9.dllxdebug.remote_enable=1xdebug.remote_host= 127.0.0.1xdebug.remote_port=9000xdebug.idekey=phpstorm4xdebug.remote_autostart=1
Explanation, the first line is the load xdebug,romote_enable is open remote debugging, the following is the parameters of remote debugging, IP, port, identification string, automatic remote debugging.
Then reboot apache,xdebug to load successfully, for God horse site will be much slower, because you turned on automatic remote debugging, each visit will connect the defined IP and port. Ha ha. Let's take a look at your own choice.
Then the IDE is configured,
Select Editconfig, and then configure it as follows:
In PHP remote Debug, configure the server 127.0.0.1 Xdebug, and then set the identification string. Here is the PHPSTORM4 that we have defined, and then save. This will be configured as well.
4. Use: Now we can start debugging.
Click on the button to start listening to remote debugging, when turned green indicates that the listener is successful. Let's set a breakpoint below.
See the wood, there is wood has a very strong, can step by step, oh, F7 single Step into the function, F8 is a single-step skip function. Have not understood the message oh.
The above describes the use of Phpstorm and xdebug to implement remote debugging methods, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.