如何使用dbgp(Xdebug)和gedit建立PHP调试会话?

时间:2018-08-03 03:22:04

标签: php laravel xdebug gedit

我需要调试我的Laravel应用程序,当我搜索Xdebug时似乎是最好的选择。到目前为止,我无法设置会话来调试应用程序,我对如何配置环境感到困惑。

因此,我使用以下命令运行Laravel应用程序:

php artisan serve --port=8001 

根据我的php --ini,xdebug的conf文件为:

$ php --ini | grep xdebug
/etc/php/7.2/cli/conf.d/20-xdebug.ini

其中包含:

$ cat /etc/php/7.2/cli/conf.d/20-xdebug.ini 
[xdebug]
zend_extension=xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.idekey=default

并要在gedit上对其进行调试,我已经安装了this plugin。并在dbgp的文本编辑器设置中:

enter image description here

有人可以向我确切解释该协议如何工作吗?如果单击“开始侦听调试会话”,它将尝试在端口8001(而不是9000)上打开一个端口,而该端口当然无法打开,并且如果必须与Xdebug一起启动PHP应用程序那么如何设置它以使用默认的Laravel命令(php artisan serve)运行它?

然后,如果我单击“在图片相关中开始调试”,它将在浏览器中打开,并带有确切的URL http://127.0.0.1/?XDEBUG_SESSION_START=default(在端口80中)

0 个答案:

没有答案
相关问题