Using Phpstorm and xdebug for remote debugging

Source: Internet
Author: User

Using Phpstorm and xdebug for remote debugging2012-05-23 10:06:35

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, can send a single step to Xdebug, abort the operation, Run 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.dll

Xdebug.remote_enable=1

xdebug.remote_host=127.0.0.1

xdebug.remote_port=9000

Xdebug.idekey=phpstorm4

Xdebug.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 configure the IDE, 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 Wood has, 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.

Using Phpstorm and xdebug for remote debugging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.