Home >Development Tools >phpstorm >How to configure phpstorm xdebug

How to configure phpstorm xdebug

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-08-14 11:22:516716browse

How to configure phpstorm xdebug

1. Installation

Open http://www.xdebug.org/download.php to download the corresponding version

But please note that you must download The version that matches the php installed on the machine will work. So you can copy the information from the phpinfo web page to http://www.xdebug.org/find binary.php, and then install it according to the instructions. As shown in the picture below:

How to configure phpstorm xdebugHow to configure phpstorm xdebug

Click to download the dll file, and then copy it to the php extension directory, for example, mine is: D:\phpserver\php-7.0 .27-nts-x64\ext

2. Configure XDebug, open php.ini, and add the following code at the end:

[Xdebug]  
;指定Xdebug扩展文件的绝对路径  
zend_extension= D:\phpserver\php-7.0.27-nts-x64\ext\php_xdebug-2.6.1-7.0-vc14-nts-x86_64.dll
;启用性能检测分析  
xdebug.profiler_enable=On
;启用代码自动跟踪  
xdebug.auto_trace=on
;允许收集传递给函数的参数变量  
xdebug.collect_params=On
;允许收集函数调用的返回值  
xdebug.collect_return=On
;指定堆栈跟踪文件的存放目录  
xdebug.trace_output_dir="D:/phpserver/tmp/Xdebug";指定性能分析文件的存放目录  
xdebug.profiler_output_dir="D:/phpserver/tmp/Xdebug"xdebug.profiler_output_name = "cachegrind.out.%p"xdebug.
remote_enable = On
xdebug.remote_port=19000xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1xdebug.var_display_max_depth = 10xdebug.idekey= PHPSTROM

Note: Modify zend_extension to your own expansion path and restart Apache.

Related recommendations: "PhpStorm Usage Tutorial"

3. You can search for the Xdebug module in the phpinfo page.

How to configure phpstorm xdebug

#Or enter php -m under cmd to see the XDebug module. As shown in the figure below:

How to configure phpstorm xdebug

# Another thing to note is the php version set in the system's environment variables. (For example, when multiple versions of PHP are configured)

phpStorm configuration

1.[File]->[Settings]->[Languages ​​& Frameworks]->[ Configure xdebug service in PHP servers.

How to configure phpstorm xdebug

#2. Configure debug, debug port is xdebug.remote_port configured in php.ini.

How to configure phpstorm xdebug

3. Open [run]--[Edit configurations]

How to configure phpstorm xdebugHow to configure phpstorm xdebug

## or

How to configure phpstorm xdebug

Then the configuration information is as follows:

How to configure phpstorm xdebug

4. Set breakpoints and enable debug monitoring. Click on the green beetle to start debugging.

How to configure phpstorm xdebug

#5. Run or debug, you can see the debugging data displayed below.

How to configure phpstorm xdebug

The above is the detailed content of How to configure phpstorm xdebug. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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