When debugging PHP in VSCode the errors/warnings etc and output are not displayed in the Debug Console when using the "Listen for Xdebug" configuration.
It does work if I use the "Launch currently open script" profile but this is no good as I need to initiate the debug from a browser as it's a web application.
Simple example below:
This screen grab is using "Launch currently open script" where the warning is showed in the console:
This is when it's triggered from a browser using "Listen for Xdebug". The Debug Console is empty.
Using:
- Latest version of VSCode (1.69.2) - have tried various Xdebug extensions, all have the same behaviour
- Xdebug 3.2
- PHP-FPM 8.2
I have come from using a very old Zend Debugger IDE and would really like to start using VSCode but this is holding me back.
My Answer:
One possible reason for this issue could be that the Xdebug configuration in your php.ini file is not set up correctly for remote debugging. Make sure that you have the following settings in your php.ini file:
[XDebug]
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_host = 127.0.0.1
xdebug.client_port = 9003
Additionally, make sure that the Xdebug extension is properly installed and enabled in your PHP configuration.
If the issue persists, you may also want to check the configuration settings in your launch.json file in VSCode to ensure that it is set up correctly for remote debugging.
If you continue to experience issues, you may want to try using a different Xdebug extension for VSCode or reach out to the VSCode community or Xdebug support for further assistance.
Rate this post
5 of 5 based on 3492 votesComments