xdebug+ vscode+ php+ Wampserver:Breakpoint在调试会话的开始时未击中
不久前,我成功解决了这个问题:
如何使用vscode / php xdebug / php debug扩展扩展名,如何正确设置VSCODE和WAMPSERVER,以便能够在断点线上进行调试和暂停?
现在,我拥有最新的PHP 8 vscode和xdebug 3,但是我的API中没有击中我的断点,它以自定义主机名从local -Host
(虚拟主机)重命名为node.js reactjs app(on on
)风险aim:3000
,在php api服务器上运行strigaim:9003
),
我无法让VSCODE调试器停止在我设置了一个断点的线路上。
我该如何解决?
这是我的设置:
php.ini的底部 c:/wamp64/bin/apache/php/php/apache2.4.46/bin/php.ini
; XDEBUG Extension
[xdebug]
zend_extension="c:/wamp64/bin/php/php8.0.9/ext/php_xdebug-3.0.4-8.0-vs16-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_mode = "req"
xdebug.mode = debug
xdebug.client_port = "9003"
xdebug.remote_log = "c:/wamp64/tmp/log"
xdebug.show_local_vars = 0
xdebug.idekey = vsc
settings.json
{
"php.executablePath": "C:/wamp64/bin/php/php8.0.9/php.exe",
}
启动
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 9003
httpd-vhosts.confs.conf
# Virtual Hosts
#
<VirtualHost *:9003>
ServerName localhost
DocumentRoot "${INSTALL_DIR}/www/"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:9003>
ServerName riskaim
DocumentRoot "${INSTALL_DIR}/www/RiskAIM/"
<Directory "${INSTALL_DIR}/www/RiskAIM/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
A while back I succeeded at resolving this problem:
Now I have PHP 8 with the latest VSCode and Xdebug 3, but my breakpoint is not hit in my API, which runs with a custom host name renamed from localhost
(virtual host) in back of a Node.js ReactJS app (on riskaim:3000
, where as the PHP API server is running on riskaim:9003
)
I can't get the VSCode debugger to stop on the line on which I have set a breakpoint.
How do I resolve this?
Here are my settings:
Bottom of php.ini
c:/wamp64/bin/apache/php/apache2.4.46/bin/php.ini
; XDEBUG Extension
[xdebug]
zend_extension="c:/wamp64/bin/php/php8.0.9/ext/php_xdebug-3.0.4-8.0-vs16-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.remote_mode = "req"
xdebug.mode = debug
xdebug.client_port = "9003"
xdebug.remote_log = "c:/wamp64/tmp/log"
xdebug.show_local_vars = 0
xdebug.idekey = vsc
settings.json
{
"php.executablePath": "C:/wamp64/bin/php/php8.0.9/php.exe",
}
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
}
]
}
Middle of httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 9003
httpd-vhosts.conf
# Virtual Hosts
#
<VirtualHost *:9003>
ServerName localhost
DocumentRoot "${INSTALL_DIR}/www/"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:9003>
ServerName riskaim
DocumentRoot "${INSTALL_DIR}/www/RiskAIM/"
<Directory "${INSTALL_DIR}/www/RiskAIM/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,我在我的API文件夹的
.htaccess
文件中添加了一条不必要的行。删除此行解决了问题,调试器步骤光标开始成功地工作。更改
。
It turns out I had added an unnecessary line in my
.htaccess
file of my api folder. Removal of this line fixed the problem and the debugger step cursor started working successfully.Changes made
.htaccess
Bottom of php.ini (c:/wamp64/bin/apache/apache2.4.46/bin/php.ini)
launch.json
httpd.conf Middle of file
httpd-vhosts.conf