【发布时间】:2021-09-29 23:01:32
【问题描述】:
在成功安装 Valet、Xdebug 并为 Xdebug 3 的 Listener 配置 VSCODE 并检查一切正常后,在第一次关闭和打开 mac(操作系统:Big Sur)时,Xdebug 开始停止工作。
我尝试使用命令重启代客
valet restart
但 Xdebug 仍然无法正常工作。
PHP 和 Xdebug 的版本:
/usr/local/bin/php -v
PHP 7.4.21 (cli) (built: Jul 12 2021 11:57:26) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.21, Copyright (c), by Zend Technologies
with Xdebug v3.0.4, Copyright (c) 2002-2021, by Derick Rethans
PHP 初始化:
php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.4
Loaded Configuration File: /usr/local/etc/php/7.4/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.4/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.4/conf.d/error_log.ini,
/usr/local/etc/php/7.4/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.4/conf.d/ext-xdebug.ini,
/usr/local/etc/php/7.4/conf.d/php-memory-limits.ini
配置 Xdebug ini:
# Configuration for Xdebug 3
[Xdebug]
zend_extension="xdebug.so"
xdebug.mode=debug
xdebug.start_with_request=default
xdebug.idekey=VSCODE
xdebug.client_port=9003
xdebug.client_host=127.0.0.1
xdebug.start_upon_error=yes
xdebug.discover_client_host=1
VSCODE 设置.json
{
"php.validate.executablePath": "/usr/bin/php",
"intelephense.environment.phpVersion": "7.4",
"intelephense.completion.fullyQualifyGlobalConstantsAndFunctions": true,
"grunt.autoDetect": "on",
"artisan.php.location": "/usr/local/bin/php"
}
配置 myproject/.vscode/lunch.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,
}
]
}
This is the output of xdebug_info()
我该如何解决?
【问题讨论】:
-
xdebug_info(); 的输出是什么,放在您要调试的脚本中?
标签: php visual-studio-code xdebug laravel-valet xdebug-3