问题
Good afternoon.
When an attempt is made to debug the script on PHP 8, PhpStorm reports that there is no connection with version 3 xdebug. Works with all versions below 3. I tried to change the parameters of xdebug.remote_{host, port} to xdebug.client_{host, port} but also did not help.
回答1:
Xdebug 3 will be fully supported in PhpStorm 2020.3 version only, which is currently in EAP stage (Early Access Program) and will be released in about 1 month time.
It is already supported in the most recent EAP #6 build: check this blog post for more info: https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/
I have downloaded Xdebug 3.0.0beta1 for my PHP 7.4 on Windows 10, configured it from scratch (using correct Xdebug 3 config values: https://3.xdebug.org/docs/upgrade_guide and https://3.xdebug.org/docs/all_settings) ... and it still works fine in PhpStorm 2020.2.3.
Yes, IDE sends old-style parameters when initiating debugging for a CLI script (like xdebug.remote_{host, port}
etc) but the debug still works just fine.
This is my php.ini content for Xdebug 3 settings (as simple as this):
[xdebug]
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9001
xdebug.mode = debug
(I have a bit mores settings, but those are customisation for output file names, log locations, extra stuff for quickly turn on some options in some scenarios/when needed etc -- these are not needed here and it works fine without them)
CLI debug initiated from IDE ("PHP Script" type of configuration):
That's what IDE is executing: E:\Projects\php\php74\php.exe -dxdebug.remote_enable=1 -dxdebug.remote_mode=req -dxdebug.remote_port=9001 -dxdebug.remote_host=127.0.0.1 E:\Projects\web\_idetest\test.php
. As you may see these old style parameters do not affect Xdebug 3 at all.
P.S. If I set xdebug.start_with_request = yes
in php.ini then debug will work even for Run (or when executing that PHP script outside of IDE) -- as long as "phone handle" icon is green (IDE listens for incoming debug requests).
来源:https://stackoverflow.com/questions/64819310/connection-was-not-established-xdebug-3-with-phpstorm