简体   繁体   English

如何在PhpStorm中使用Xdebug

[英]How to use Xdebug in PhpStorm

I have a trouble to use debugger in my code, it's my first time to use debugger, I don't know that I am doing it the right way or not, but it is not working for me. 我在我的代码中使用调试器时遇到了麻烦,这是我第一次使用调试器,我不知道我是以正确的方式做到了,但它对我不起作用。 it always show this message in variables section... 它总是在变量部分显示此消息...

Waiting for incoming connection with ide key '13001' 使用ide键'13001'等待传入连接

I followed this step... 我跟着这一步......

1. my php.ini setting for xdebug 1.我的xdebug的php.ini设置

[Xdebug]
zend_extension="D:\XAMMPI\php\ext\php_xdebug-2.4.0-5.6-vc11.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=80 //i also try the default port (9000) here but it still not working
xdebug.idekey=PHPSTORM

2. I create the configuration setting for Debugger. 2.我为Debugger创建配置设置。

配置设置

3. I apply the break point to code for testing 3.我将断点应用于代码进行测试

断点的地方

I am using PhpStorm 2016.1 我正在使用PhpStorm 2016.1

Any help will be appreciated 任何帮助将不胜感激

UPDATE - 1 更新 - 1

在此输入图像描述

Just use my php.ini setting for xdebug 只需使用我的php.ini设置xdebug

[XDebug]
zend_extension="D:\XAMMPI\php\ext\php_xdebug-2.4.0-5.6-vc11.dll" ; copied this link based on your config.
xdebug.remote_enable=true
xdebug.remote_host=127.0.0.1
xdebug.remote_port=10000
xdebug.remote_autostart=1
xdebug.idekey=

Then install xDebug helper for chrome: 然后为chrome 安装xDebug helper

https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en

Then change the IDE key to phpstorm 然后将IDE密钥更改为phpstorm 将IDE密钥更改为phpstorm

After that, you should create a PHP Remote Debug and not PHP Web Application 之后,您应该创建PHP远程调试而不是PHP Web应用程序

Like the picture below. 如下图所示。

在此输入图像描述

On your settings. 在你的设置上。 Which can be accessed using Ctrl+Alt S . 可以使用Ctrl+Alt S访问。 Search for Debug port, and change it to 10000. 搜索调试端口,并将其更改为10000。

在此输入图像描述

After that you should navigate to your extension in chrome and activate xDebug. 之后,您应该在chrome中导航到您的扩展程序并激活xDebug。

在此输入图像描述

And that's it. 就是这样。 Happy Debugging :) 快乐调试:)

Waiting for incoming connection with ide key '13001'

vs VS

xdebug.idekey=PHPSTORM

you need to set proper idekey in PHPStorm, and change back ports to 9000. 80 is port for apache (http server), so it will not work as you've configured. 你需要在PHPStorm中设置正确的idekey,并将端口更改为9000.80是apache(http服务器)的端口,所以它不会像你配置的那样工作。

Look here to learn where to set the idekey in ide: https://www.jetbrains.com/help/phpstorm/2016.1/run-debug-configuration-php-remote-debug.html 在这里查看在ide中设置idekey的位置: https ://www.jetbrains.com/help/phpstorm/2016.1/run-debug-configuration-php-remote-debug.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM