The author’s development environment is as follows: Windows8.1 Apache PhpStorm XDebug Firefox (XDebug helper 1.4.3 plug-in).
1. XDebug installation configuration
(1) Download XDebug download address: http://www.xdebug.org/ You 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 install it according to the instructions. As shown below:
(2) Install XDebug. Download "php_xdebug-2.3.2-5.4-vc9.dll" as shown above and copy it to the d:phpext directory.
(3) Configure XDebug to open d:phpphp.ini and add the following code at the end:
[Xdebug]
zend_extension = d:phpextphp_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. Detection method 1: In the phpinfo web page, if you can retrieve the word XDebug, the installation is successful, as shown in the figure below:
Detection method 2:
Enter php -m under cmd, you can see XDebug indicating that the configuration is successful. As shown below:
2. The XDebug configuration in PHPStorm is in the Settings of [File]->[Settings]->[Languages & Frameworks]->[PHP]:
(1) Configure PHP Server to find [Servers]. The configuration items are as follows: Name: localhostHost: localhostPort: 80Debugger: XDebug as shown below:
(2) Configure PHP Debug to find [Debug], fill in the Debug Port in XDebug with 9000, and other defaults. As shown below:
3. 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 picture above, click [Options], and then configure it as follows: IDE key: PhpStormDomain filter:
localhost is shown below:
4. Debugging methods and steps using XDebug
(1) Turn on Debug monitoring in PHPStorm. Click on the phone-like icon to turn on Debug monitoring, as shown in the figure below:
(2) Turn on the XDebug helper plug-in in the Chrome browser
Method 1: In the address bar, click on the bug and select Debug, as shown in the figure below:
Method 2: Use the shortcut key: CTRL SHIFT X to configure.
(3) Set a breakpoint in PHPStorm. Click on the blank space after the line number to set a breakpoint.
(4) Breakpoint debugging and then guide to the corresponding breakpoint in the browser can be automatically broken, as shown in the figure below:
There are all breakpoint processing methods and shortcut key tips in the red box.
The above is the entire content of this article. I hope it will be helpful to everyone in learning PHP debugging tutorials.