在成功安装 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,
}
]
}
我该如何解决?