我没有使用我的phpstorm 2021.1.4在Xdebug中调试Laravel 8应用程序

发布于 2025-01-23 18:59:58 字数 1643 浏览 1 评论 0 原文

我尝试使用我的phpstorm 2021.1.4在Xdebug中调试我的Laravel 8应用程序 我已经在本地ubuntu 20 OS中安装了Xdebug:


$ php -v
PHP 8.1.4 (cli) (built: Apr  4 2022 13:30:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

我在 /etc/php/8.1/apache2/conf.d/20-xdebug.ini 中添加了参数:

zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003

xdebug.idekey=PHPSTORM
xdebug.default_enable = 1

xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9003

implicit_flush= On

; xdebug.remote_handler="dbgp"

但是我不确定哪些参数必须在这个文件中?我在Google中进行了搜索,在不同情况下,此信息有所不同。

在控制台中运行服务器:

php artisan serve

我使用URL在Chrome浏览器中运行该应用程序:

http://127.0.0.1:8000

我已经安装了Chrome Xdebug扩展名: https:// https:////// prnt.sc/ibi42ssbkstr 我希望当我刷新此页面时,我的phpstorm将停止流动,并将打开断裂点。

在phpstorm中,我有设置: https://prnt.sc/wgysoleusjbf 使用调试端口9003和上面的文件中。

和主页上断: https://prnt.sc/mmsz5kmioyn17 and: https://prnt.sc/gkijtxj2llrb

有什么问题?

I try and fail to debug my Laravel 8 app in Xdebug with my PhpStorm 2021.1.4
I have installed Xdebug in my local Ubuntu 20 OS:


$ php -v
PHP 8.1.4 (cli) (built: Apr  4 2022 13:30:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.4, Copyright (c), by Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

I added parameters in my /etc/php/8.1/apache2/conf.d/20-xdebug.ini:

zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9003

xdebug.idekey=PHPSTORM
xdebug.default_enable = 1

xdebug.remote_enable=1
xdebug.remote_host="localhost"
xdebug.remote_port=9003

implicit_flush= On

; xdebug.remote_handler="dbgp"

But I am not sure which parameters must be in this file? I searched in google and this information is different in different cases.

Running server in console :

php artisan serve

I run the app in my Chrome browser with an URL:

http://127.0.0.1:8000

I have installed Chrome Xdebug extension: https://prnt.sc/IBI42sSbKStr
I expected that when I refresh this page my PhpStorm will stop flow and break point will be opened.

In PhpStorm I have settings : https://prnt.sc/WgYSOlEuSjbf
with Debug port 9003 and in the file above.

and Home page break : https://prnt.sc/MSZ5KmIOYn17
and : https://prnt.sc/gKIjTXj2LlRb

What is wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

dawn曙光 2025-01-30 18:59:59

您只需要 20-xdebug.ini 中的以下内容:

zend_extension=xdebug.so
xdebug.mode=debug

但是,我将使用 xdebug.mode =开发,debug 而不是。

其他设置要么已经是默认设置( xdebug.client_host = 127.0.0.0.1 xdebug.client_port = 9003 ),要用于Xdebug的旧版本(2)( xdebug.remote*和 xdebug.default_enable )。

如果安装浏览器扩展程序,则仍然需要单击其中的图标,以启用调试。

如果这不起作用,那么您可以尝试使用其中的 xdebug_info()在其中(例如,在您的index.php文件中)进行调试。然后,如果指示连接到您的IDE,这将告诉您启用了哪些模式,以及Xdebug尝试执行的操作。

如果也没有提供足够的信息,则可以设置 xdebug.log =/tmp/xdebug.log xdebug.log_level = 10 ,然后停止,重新启动,重新启动<<代码> PHP Artisan Server ,然后在浏览器中重新加载页面,它应该包含大量信息,内容涉及脚本开始期间发生的事情,Xdebug将检查参数等,并尝试连接到您的IDE 。

You would only need the following in 20-xdebug.ini:

zend_extension=xdebug.so
xdebug.mode=debug

I would however use xdebug.mode=develop,debug instead.

The other settings are either already the default (xdebug.client_host=127.0.0.1, xdebug.client_port=9003) or for an older version (2) of Xdebug (xdebug.remote* and xdebug.default_enable).

If you install the browser extension, you still need to click the icon in it, to enable debugging.

If this does not work, then you can try debugging a page with xdebug_info() in it (in your index.php file, for example). This will then tell you which modes are enabled, and what Xdebug tried to do, if instructed to connect to your IDE.

If that also does not provide enough information, you can set xdebug.log=/tmp/xdebug.log and xdebug.log_level=10, and then after stopping, restarting php artisan server, and reloading a page in the browser it should contain a wealth of information of what went on during the start of your script, where Xdebug would check for parameters etc, and try to connect to your IDE.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文