Home > Backend Development > PHP Tutorial > PHP+PhpStorm+Xdebug configuration method

PHP+PhpStorm+Xdebug configuration method

WBOY
Release: 2016-07-28 08:28:08
Original
1325 people have browsed it

This article contains the following content:

  • Xdebug file download and configuration
  • IDE (PhpStorm) initiated debugging
  • Chrome initiated debugging

1. Xdebug file download and configuration

Enter the Xdebug download page and select the appropriate Xdebug version according to the prompts.

 PHP+PhpStorm+Xdebug配置方法

In the Xdebug download page, you need to copy the source code of the local phpinfo() into the text box. Taking Chrome as an example, press F12 to view the phpinfo() source code, right-click ->Copy->Copy element, fill the copied content into the text box, click the Analysemy phpinfo() output button below, and Xdebug will prompt to download Which file and how to configure it.

 PHP+PhpStorm+Xdebug配置方法

 PHP+PhpStorm+Xdebug配置方法

Configure the php.ini file according to Xdebug prompts. My configuration file is as follows

zend_extension =D:\AppServ\php5\ext\php_xdebug-2.4.0-5.6-vc11.dll
xdebug.remote_enable = On
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
xdebug.idekey= PHPSTROM
Copy after login

2. IDE (PhpStorm) initiates debugging

After the first step of configuration, we can see the Xdebug configuration information in the phpinfo() output information. At this point, it means that php's extension of Xdebug has been completed, and the next step is to configure PhpStorm.

 PHP+PhpStorm+Xdebug配置方法

Click the "Run/Debug Configurations" button in the upper right corner and select Edit Configurations.

 PHP+PhpStorm+Xdebug配置方法

Select the PHP Web Application item

 PHP+PhpStorm+Xdebug配置方法

Set the corresponding information according to your own situation, click OK

 PHP+PhpStorm+Xdebug配置方法

You can see the "Run" and "Debug" buttons are lit, and when you need to interrupt Click the debugging page to set a breakpoint, and then click the debug button to enter debugging mode.

3. Debugging initiated by Chrome

The characteristic of debugging initiated by IDE (PhpStorm) is that the web page is opened by the IDE, and the configuration information needs to be changed frequently, which is very inconvenient to use. Chrome initiates debugging, just like normal web page debugging. The configuration method is as follows:

PhpStorm configuration

Open PhpStorm and enter File->Settings->PHP->Servers, fill in the server-related information.

 PHP+PhpStorm+Xdebug配置方法

Enter File->Settings->PHP->Debug, set the Debug port to 9000.

 PHP+PhpStorm+Xdebug配置方法

Enter File->Settings->PHP->Debug-> DBGp Proxy, configure IDE key, Host, Port and other information.

 PHP+PhpStorm+Xdebug配置方法

Turn on the phone button in the upper right corner of PhpStorm to maintain debugging and monitoring.

 PHP+PhpStorm+Xdebug配置方法

Chrome Configuration

Download and add the Chrome plugin. After the plug-in is installed, as shown in the figure

 PHP+PhpStorm+Xdebug配置方法

Click the icon on the page that needs to be debugged, select Debug and refresh again to see the breakpoint debugging information of Php.


The above introduces the PHP+PhpStorm+Xdebug configuration method, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template