简体   繁体   English

通过设置Xdebug和PHPStorm进行调试

[英]Debugging with setting Xdebug and PHPStorm

i'm using PHPStorm and trying to run Xdebug according this video https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20?autoplay=true . 我正在使用PHPStorm并尝试根据此视频https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20?autoplay=true运行Xdebug。

First part works perfectly ( https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/19?autoplay=true ), but i'm stuck at second one. 第一部分工作正常( https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/19?autoplay=true ),但我陷于第二部分。

Port 9000 was not working, so i changed it to 10000. 端口9000无法正常工作,因此我将其更改为10000。

I configured PHP Web Application configuration 我配置了PHP Web应用程序配置

在此处输入图片说明 在此处输入图片说明

and after I press debug button, web is blank 然后按调试按钮后,网站为空白

在此处输入图片说明

and still loading and PHPStorm is waiting for incoming connection. 并且仍在加载中,PHPStorm正在等待传入连接。

在此处输入图片说明

I have checked "can accept external connection" at PHP - Debug - Xdebug and xdebug in php.ini configured like this: 我已经在PHP上选中“可以接受外部连接”-调试-php.ini中的Xdebug和xdebug配置如下:

[XDebug]

zend_extension="/usr/local/Cellar/php56-xdebug/2.3.3/xdebug.so"

xdebug.remote_enable = 1
xdebug.cli_color = 1
xdebug.show_local_vars = 1

xdebug.remote_port = 10000
xdebug.remote_host= localhost
xdebug.remote_autostart = 1

xdebug.remote_log="/usr/local/tmp/xdebug.log"
xdebug.idekey = "PHPSTORM"
xdebug.ide_key = "PHPSTORM"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir="/usr/local/tmp/xdebug-profiler"
xdebug.profiler_enable_trigger = 1

I tried to validate web server with this result: 我试图用以下结果验证Web服务器:

在此处输入图片说明

I was googling and trying solve this for 6 hours, try to help me please, i`m kind of dummy in this. 我在谷歌上搜索了6个小时,尝试解决这个问题,请尝试帮助我,我有点像个假人。

Using OS X El Capitan. 使用OS X El Capitan。

I can debug single script, but not a whole website. 我可以调试单个脚本,但不能调试整个网站。

When i run this directly online-chef.dev:10000, it says ERR_CONNECTION_REFUSED. 当我直接在线运行此文件chef.dev:10000时,它说ERR_CONNECTION_REFUSED。

"online-chef.dev" is at local virtual host. “ online-chef.dev”在本地虚拟主机上。

What I am doing wrong? 我做错了什么?

Thank you so much! 非常感谢!

You are tried to debug web page through xdebug. 您试图通过xdebug调试网页。 For debug javascript you need install browser extention . 对于调试javascript,您需要安装浏览器扩展 This is manual for javascript debugging . 这是javascript调试手册

For javascript debug get current extention port and enter in this place: 对于javascript调试,请获取当前扩展端口,然后在此位置输入:

在此处输入图片说明

For XDebug i don't want always click debug button, so i simple enable listen connections. 对于XDebug,我不希望总是单击debug按钮,因此我简单地启用侦听连接。 This is manual for XDebug from JetBrains. 这是 JetBrains的XDebug手册

在此处输入图片说明

Here is my xdebug config that working with listen connections. 这是我的xdebug配置,用于监听连接。

xdebug.idekey = "PHPSTORM"
xdebug.remote_port = 9001
xdebug.remote_mode = "req"
xdebug.remote_host = 10.0.2.2
xdebug.remote_handler = "dbgp"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.extended_info = 1

So, when i need debug javascript i click debug button. 因此,当我需要调试JavaScript时,我单击调试按钮。 When i need debug php i just put breakpoint. 当我需要调试PHP时,我只设置了断点。

First set up debugging instruments often is hard, but it's pays off. 首先设置调试工具通常很困难,但是很值得。

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

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