How to debug PHPStorm+XDebug
This article mainly introduces how to debug PHPStorm+XDebug. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
1. XDebug installation and configuration
(1) download XDebug download address: http://www.xdebug.org/ must download a version that matches the php installed on the machine. The specific download method is as follows: copy the source code of the phpinfo web page to http://www.xdebug.org/find-binary.php, and then follow the instructions to install it. As shown in the following figure:
(2) install XDebug to download "php_xdebug-2.3.2-5.4-vc9.dll" as shown above, and copy it to the d:\ php\ ext\ directory.
(3) configure XDebug to open d:\ php\ php.ini, and add the following code at the end:
[Xdebug]
Zend_extension = d:\ php\ ext\ php_xdebug-2.3.2-5.4-vc9.dll
Xdebug.remote_enable = 1
Xdebug.remote_handler = "dbgp"
Xdebug.remote_host = "localhost"
Xdebug.remote_mode = "req"
Xdebug.remote_port = 9000
Restart Apache.
(4) verify whether the installation is successful. Method 1: if the word XDebug can be retrieved in the phpinfo web page, the installation is successful, as shown in the following figure:
Detection method 2:
Enter php-m under cmd and you can see that XDebug is configured successfully. As shown in the following figure:
2. The XDebug in PHPStorm is configured in the Setting of [File]-> [Settings]-> [Languages & Frameworks]-> [PHP]:
(1) configure PHP Server to find [Servers]. The configuration items are as follows: Name:localhostHost:localhostPort:80Debugger:XDebug is shown below:
(2) configure PHP Debug to find [Debug]. Enter 9000 for Debug Port in XDebug, and other defaults. As shown in the following figure:
III. Configuration of XDebog helper plug-in in Fireforx
(1) install the XDebug helper plug-in as shown below:
(2) configure the XDebug helper plug-in in the figure above, click "options", and then configure it as follows: IDE key:PhpStormDomain filter:
The localhost is shown in the following figure:
4. Debugging methods and steps using XDebug
(1) enable Debug monitoring in PHPStorm and click the icon like the phone to enable Debug monitoring, as shown below:
(2) Open the XDebug helper plug-in in the Chrome browser
Method 1: in the address bar, click the bug and select Debug, as shown in the following figure:
Method 2: use the shortcut key: CTRL+SHIFT+X for configuration.
(3) set a breakpoint in PHPStorm. Click in the space after the line number to set the breakpoint.
(4) the method of debugging a breakpoint and then booting to the corresponding breakpoint in the browser can be broken automatically, as shown in the following figure:
There are all breakpoint handling and shortcut key tips in the red box.
These are all the contents of the article "how to debug PHPStorm+XDebug". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!