我有一个基于 Ubuntu 20.10 (Groovy Gorilla)的Vagrant 设置,用于处理定制的 PHP项目,我用它作为开发 PHP 项目的基础。我意识到那个版本的 Ubuntu 不支持了,所以我更新到 hirsute (21.04)(因为它仍然有 PHP 7.4)我有一个工作的 Xdebug 配置工作,但显然升级时坏了。
我跑去sudo ufw allow 9000
尝试打开防火墙,但显然这根本没有任何效果。
为了让调试器正确附加,我缺少什么?
xdebug.ini 用于 2.x 版(有效):
[XDebug]
zend_extension = "/usr/lib/php/20190902/xdebug.so"
xdebug.remote_enable = true
xdebug.remote_port = 9000
xdebug.remote_autostart = on
xdebug.max_nesting_level = 512
xdebug.remote_host = 10.0.2.2
版本 3 的 xdebug.ini:
[XDebug]
zend_extension = "/usr/lib/php/20190902/xdebug.so"
xdebug.idekey=VSCODE
xdebug.mode=debug
xdebug.client_host=10.0.2.2
xdebug.client_port=9000
xdebug.start_with_request=yes
xdebug.start_upon_error=yes
xdebug.max_nesting_level = 512
xdebug.log="/var/log/apache2/xdebug.log"
xdebug.log_level=10
启动.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"pathMappings": {
"/var/www/myProject": "${workspaceFolder}/src/",
},
"port": 9000,
"log": true
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}"
}
]
}
xdebug.log
[2714] Log opened at 2022-01-30 23:49:45.800199
[2714] [Step Debug] INFO: Connecting to configured address/port: 10.0.2.2:9003.
[2714] [Step Debug] INFO: Connected to debugging client: 10.0.2.2:9003 (through xdebug.client_host/xdebug.client_port). :-)
[2714] [Step Debug] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/myProject/loginHandler.php" language="PHP" xdebug:language_version="7.4.11" protocol_version="1.0" appid="2714" idekey="VSCODE"><engine version="3.0.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2021 by Derick Rethans]]></copyright></init>
[2714] [Step Debug] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[2714] [Step Debug] WARN: 2022-01-30 23:51:01.452897: There was a problem sending 179 bytes on socket 19: Broken pipe.
[2714] Log closed at 2022-01-30 23:51:01.453245
xdebug_info()
PHP
Build Configuration
Version 7.4.11
Debug Build no
Thread Safety disabled
Settings
Configuration File (php.ini) Path /etc/php/7.4/cli
Loaded Configuration File /etc/php/7.4/apache2/php.ini
Scan this dir for additional .ini files /etc/php/7.4/apache2/conf.d
Additional .ini files parsed /etc/php/7.4/apache2/conf.d/10-mysqlnd.ini, /etc/php/7.4/apache2/conf.d/10-opcache.ini, /etc/php/7.4/apache2/conf.d/10-pdo.ini, /etc/php/7.4/apache2/conf.d/15-xml.ini, /etc/php/7.4/apache2/conf.d/20-calendar.ini, /etc/php/7.4/apache2/conf.d/20-ctype.ini, /etc/php/7.4/apache2/conf.d/20-curl.ini, /etc/php/7.4/apache2/conf.d/20-dom.ini, /etc/php/7.4/apache2/conf.d/20-exif.ini, /etc/php/7.4/apache2/conf.d/20-ffi.ini, /etc/php/7.4/apache2/conf.d/20-fileinfo.ini, /etc/php/7.4/apache2/conf.d/20-ftp.ini, /etc/php/7.4/apache2/conf.d/20-gd.ini, /etc/php/7.4/apache2/conf.d/20-gettext.ini, /etc/php/7.4/apache2/conf.d/20-iconv.ini, /etc/php/7.4/apache2/conf.d/20-json.ini, /etc/php/7.4/apache2/conf.d/20-mbstring.ini, /etc/php/7.4/apache2/conf.d/20-mysqli.ini, /etc/php/7.4/apache2/conf.d/20-pdo_mysql.ini, /etc/php/7.4/apache2/conf.d/20-phar.ini, /etc/php/7.4/apache2/conf.d/20-posix.ini, /etc/php/7.4/apache2/conf.d/20-readline.ini, /etc/php/7.4/apache2/conf.d/20-shmop.ini, /etc/php/7.4/apache2/conf.d/20-simplexml.ini, /etc/php/7.4/apache2/conf.d/20-sockets.ini, /etc/php/7.4/apache2/conf.d/20-sysvmsg.ini, /etc/php/7.4/apache2/conf.d/20-sysvsem.ini, /etc/php/7.4/apache2/conf.d/20-sysvshm.ini, /etc/php/7.4/apache2/conf.d/20-tokenizer.ini, /etc/php/7.4/apache2/conf.d/20-xdebug.ini, /etc/php/7.4/apache2/conf.d/20-xmlreader.ini, /etc/php/7.4/apache2/conf.d/20-xmlwriter.ini, /etc/php/7.4/apache2/conf.d/20-xsl.ini, /etc/php/7.4/apache2/conf.d/20-zip.ini
Directive Local Value Master Value Docs
xdebug.mode debug debug
xdebug.start_with_request yes yes
xdebug.start_upon_error yes yes
xdebug.output_dir /tmp /tmp
xdebug.trigger_value no value no value
xdebug.file_link_format no value no value
xdebug.filename_format no value no value
xdebug.log /var/log/xdebug/xdebug.log /var/log/xdebug/xdebug.log
xdebug.log_level 10 10
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth 3 3
xdebug.max_nesting_level 512 512
xdebug.cli_color 0 0
xdebug.force_display_errors Off Off
xdebug.force_error_reporting 0 0
xdebug.halt_level 0 0
xdebug.max_stack_frames -1 -1
xdebug.show_error_trace Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars Off Off
xdebug.dump.COOKIE no value no value
xdebug.dump.ENV no value no value
xdebug.dump.FILES no value no value
xdebug.dump.GET no value no value
xdebug.dump.POST no value no value
xdebug.dump.REQUEST no value no value
xdebug.dump.SERVER no value no value
xdebug.dump.SESSION no value no value
xdebug.dump_globals On On
xdebug.dump_once On On
xdebug.dump_undefined Off Off
xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
xdebug.profiler_append Off Off
xdebug.cloud_id no value no value
xdebug.client_host 10.0.2.2 10.0.2.2
xdebug.client_port 9000 9000
xdebug.discover_client_host Off Off
xdebug.client_discovery_header no value no value
xdebug.idekey VSCODE VSCODE
xdebug.connect_timeout_ms 200 200
xdebug.scream Off Off
xdebug.gc_stats_output_name gcstats.%p gcstats.%p
xdebug.trace_output_name trace.%c trace.%c
xdebug.trace_format 0 0
xdebug.trace_options 0 0
xdebug.collect_assignments Off Off
xdebug.collect_return Off Off