我尝试用我的PhpStorm 2021.1.4在我的本地Ubuntu20OS中调试我的Laravel 8应用程序,但失败了:
$ 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"但是我不确定这个文件中必须包含哪些参数?我在谷歌搜索,这些信息在不同的情况下是不同的。
在控制台中运行服务器:
php artisan serve我在Chrome浏览器中使用URL运行该应用程序:
http://127.0.0.1:8000我已经安装了Chrome调试扩展:https://prnt.sc/IBI42sSbKStr,我希望当我刷新这个页面时,我的PhpStorm将停止流,并打开断点。
在PhpStorm中,我有设置:带有调试端口9003的https://prnt.sc/WgYSOlEuSjbf和上面的文件。
主页中断:https://prnt.sc/MSZ5KmIOYn17和:https://prnt.sc/gKIjTXj2LlRb
怎么啦?
发布于 2022-04-24 23:40:20
在20-xdebug.ini中只需要以下内容
zend_extension=xdebug.so
xdebug.mode=debug不过,我会使用xdebug.mode=develop,debug代替。
其他设置要么已经是默认设置(xdebug.client_host=127.0.0.1,xdebug.client_port=9003),要么是较旧版本(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。
https://stackoverflow.com/questions/71989357
复制相似问题