Phpstorm Configuration Xdebug

Source: Internet
Author: User

First, configure the Xdebug.

Add the following configuration to the php.ini (note restart Apache or nginx):

  1. [xdebug]

  2. zend_extension="/usr/local/opt/php55-xdebug/xdebug.so"

  3. xdebug.remote_enable=On

  4. xdebug.remote_autostart=Off

  5. xdebug.remote_host="localhost"

  6. xdebug.remote_port=9002

  7. xdebug.remote_handler="dbgp"

  8. ;可以是任意Key,这里设定为PHPSTORM

  9. xdebug.idekey="PHPSTORM"

Note: I am using the Mac Brew-emp (nginx+mysql+php), its xdebug configuration file is not php.ini, but in/USR/LOCAL/ETC/PHP/5.5/CONF.D in the Ext-xdebug.ini

Configuring Phpstorm Xdebug Listening Servers and PHP applications (projects)

Phpstorm edit configurations on the right

Pick up:

For example, fill in the name of the PHP site, as well as the server (first without the server, you need to add (see), host is your virtual hostname, the port is typically 80 unless you specify a different port when the virtual host configuration)

Once configured, as shown in:

Note: Start URL to see the specific situation, I am using Nginx, www.test.com is in the browser can directly access to the homepage of my site, so I will directly fill out a slash "/" on the line, if you want to specify a specific file, then fill it up.

The last application (apply)--saves (save).

Setting the port Phpstorm xdebug listening

(The port number is as long as the system is useless, but with the same port number in the previous Xdebug configuration file "xdebug.remote_port=9002"), the method is set up as follows:

In Phpstorm settings, search for Debug, find languages & Frameworks--php--debug

In the previous step, click Debug to enter the following interface:

Other options can be selected, but note that the debug port is the same as the port in the Xdebug configuration:

Installing the Xdebug plugin in the browser

1, Google Browser installation Xdebug Helper plugin

2. Firefox installs easy Xdebug plugin

Search for two easy debugs, with the newer one

For example, click on the bug, when the bug has a red minus sign, the start of monitoring debug, when the square is red (mouse click switchable state), will be recorded in the cookie Xdebug profile

Non-listening Status monitoring state: (as long as the worm has a minus sign to indicate the listening state, when the square does not have to become red, if it turns red is to open a cookie, specific role I do not know)

Cookies:

Getting Started with Xdebug

First, hit one or more breakpoints in the code (the program will break and then output the debug information)

then select the application to debug in the Phpstorm (because you can create multiple applications to debug), then click the Small phone icon to start listening to debug (not listening status:, listening Status:), and finally click on the bug

After clicking on the bug, it will automatically open with the browser and will automatically jump back to Phpstorm (see where you debug, sometimes not necessarily jumping), and at this point the debug information will be output below the phpstorm.

When you set debug, the code color color of the line that runs to

How is this information removed from the debug line?

Click on the button below to remove

Debugging tip: Stepping through commands the difference between step into/step out/step over

Step into is stepping into the sub-function, entering and continuing to step into the execution;


Step over is a step in the execution, in the function when the child function is not entered into the sub-function of stepping, but the entire execution of the child function to stop, that is, the whole function as a step. One thing, after our simple debugging, is the same as the step into effect when there are no sub-functions.


Step out is but when stepping into the sub-function, with step out can execute the remainder of the child function, and return to the previous layer of the letter
Number.

Step Into: Enter sub-function
Step over: The child function is crossed, but the child function executes
Step out: Jump out of sub-functions



From for notes (Wiz)



Phpstorm Configuration Xdebug

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.