browser doesn't request to vscode xdebug server

49 Views Asked by At

I Try to use xdebug in Windows 10.

I had used xdebug in My Mac machine.

But, In windows 10, I installed xdebug 2.9.8 then config it.

It does not work as I thought.

Below is my php.ini


; XDEBUG Extension
[xdebug]
zend_extension = c:\wamp64\bin\php\php7.1.33\ext\php_xdebug.dll
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
xdebug.remote_host='127.0.0.1'
xdebug.remote_port=9003
xdebug.log="c:/wamp64/logs/xdebug.log

I confirmed it was intalled correctly using php -v

Then I installed php-debug extension in my vscode.

and then my apache vhost is like below.

<VirtualHost *:80>
  ServerName hello.localhost
  DocumentRoot "${INSTALL_DIR}/www/hello"
  <Directory "${INSTALL_DIR}/www/hello/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>

This is all my settings about debugging php.

My expectation is to trigger browser to xdebug server running in vscode When I request to my apache hosts hello.localhost.

But It does not work.

I confirmed any other script worked well for debugging scripts such as debugging current scripts and built-in server configs automatically configured in php-debug extension.

I wanna to try is Listen for xdebug script in vscode. It does not work.

What does I have to configure more?

xdebug

xdebug2

And below is my vscode configure for xdebug.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "port": 9003
    }
  ]
}
1

There are 1 best solutions below

12
b126 On

Verify that you have first well linked your vHost with your Xdebug

You should then have xdebug.client_host=127.0.0.1 or xdebug.client_host=hello.localhost enabled in your PHP.INI.

Also make sure that you have disabled Zend OPCACHE extension.

[opcache]
;zend_extension="C:\wamp64\bin\php\php7.2.33\ext\php_opcache.dll"

Call xdebug_info(); on a PHP page and verify all these settings.

Finally, call the page you want to debug by adding ?XDEBUG_SESSION=1 to your querystring or call xdebug_break(); directly in your code.