我安装了:-> Xampp 3.2.2 (PHP 7.1.15), -> XDebug "已安装:2.9.5" (来自xdebug向导的版本) -> 和BRACKETS 1.14与PHP调试器扩展。
在调试窗口中,我的 "RUN"、"STOP "等按钮都是灰色的,我一直看到。
Server started listening on port: 9000 idekey: xdebug
我的文件 brackets.json:
{
"brackets-eslint.gutterMarks": true,
"brackets-eslint.useLocalESLint": false,
"fonts.fontSize": "18px",
"fonts.fontFamily": "",
"themes.theme": "dark-theme",
"linting.collapsed": true,
"livedev.multibrowser": false,
"noDistractions": false,
"smartIndent": false,
"php-debugger.idekey": "xdebug",
"php": {
"enablePhpTooling": true,
"executablePath": "C:\\XAMPP\\php\\php.exe",
"memoryLimit": "4095M",
"validateOnType": "false"
}
}
Apache PHP.ini
output_buffering = off
(...)
[XDebug]
zend_extension = c:\xampp\php\ext\php_xdebug.dll
xdebug.default_enable=1
xdebug.idekey=xdebug
xdebug.remote_autostart = 1
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = c:\xampp\tmp
xdebug.remote_mode = req
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.remote_handler = dbgp
xdebug.remote_connect_back=1
xdebug.remote_host = localhost
xdebug.remote_log = c:\xampp\tmp\xdebug.txt
xdebug.remote_port = 9000
xdebug.trace_output_dir = c:\xampp\tmp
xdebug.remote_cookie_expire_time = -9999
xdebug.show_local_vars = 0
xdebug.max_nesting_level = 1000
我的文件test.php
echo 'A';
echo 'B'; <- here I put breakpoint (red dot)
echo 'C';
总是返回'ABC'。无论我是否使用?XDEBUG_SESSION_START=xdebug或chrome xdebug helper扩展:我的断点完全不工作。如果我在 PHP 调试器窗口中输入一些东西,我就会收到。
An active debugging session is required for code evaluation.
我尝试了上百种不同的设置,包括修改php.ini中的 "onoffs "为10,把dll路径加引号,localhost改为 "127.0.0.1",但都没有用。当然我每次设置改变后都重启Apache和括号。我喜欢Brackets,因为它的外观简单(我刚开始学习php,我不愿意学习复杂的IDE),也因为实时预览功能。先谢谢你了。
最后我找到了工作设置。也许这能帮助到别人。
(...)
output_buffering = off
(...)
[XDebug]
zend_extension = c:\xampp\php\ext\php_xdebug.dll
xdebug.default_enable = 1
xdebug.idekey = "xdebug"
xdebug.remote_autostart = 0
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "c:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.remote_connect_back = 0
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_mode=req
xdebug.remote_connect_back=0
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = "c:\xampp\tmp\xdebug.txt"
xdebug.remote_port = 9000
xdebug.trace_output_dir = "c:\xampp\tmp"
xdebug.remote_cookie_expire_time = -9999
xdebug.show_local_vars = 0
xdebug.max_nesting_level = 1000
我有时会收到 "实时预览 "的错误,但这是另一个需要解决的问题,与xdebug没有严格的关系,我相信......