I try to get started with Xdebug for multiple hours without success.
First I determined which php_xdebug.dll version I need by visiting this official link, and followed their instructions.
Summary
Xdebug installed: 2.6.0
Server API: Apache 2.0 Handler
Windows: yes - Compiler: MS VC15 - Architecture: x86
Zend Server: no
PHP Version: 7.2.3
Zend API nr: 320170718
PHP API nr: 20170718
Debug Build: no
Thread Safe Build: yes
Configuration File Path: C:\WINDOWS
Configuration File: A:\xampp\php\php.ini
Extensions directory: A:\xampp\php\ext
You're already running the latest Xdebug version
But here are the instructions anyway:
1. Download php_xdebug-2.6.0-7.2-vc15.dll
2. Move the downloaded file to A:\xampp\php\ext
3. Update A:\xampp\php\php.ini and change the line
zend_extension = A:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll
4. Restart the webserver
This is my php.ini
snippet:
[XDebug]
zend_extension="A:\xampp\php\ext\php_xdebug-2.6.0-7.2-vc15.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.remote_enable = on
xdebug.remote_handler = "dbgp"
xdebug.remote_host = localhost
xdebug.remote_port = 9001
xdebug.trace_output_dir = "A:\xampp\tmp"
xdebug.remote_log = "A:\xampp\tmp\xdebug\xdebug.log"
xdebug.idekey = "netbeans-xdebug"
xdebug.remote_autostart = on
xdebug.remote_connect_back = on
I set the port
and idekey
in netbeans accordingly (Tools -> Options -> PHP -> Debugging).
...I also made sure that the project is using the settings (Project -> Properties -> Run Configuration)
I restarted NetBeans and Apache. I even installed the extension "Xdebug helper" and "NetBeans Connector". The Xdebug helper extension is already configured and set to debug mode.
Now I set a breakpoint. But I get "Waiting For Connection (netbeans-xdebug)" after right clicking in the source code and clicking on "Debug File", and it is loading forever.
I also can't click on the debug buttons, they are all grayed out:
I always call the target site with the following parameter, like instructed in the official documentation: ?XDEBUG_SESSION_START=netbeans-xdebug
I tried different solutions from other questions on SO, but nothing helped.
I already tried to change the line xdebug.remote_host
in php.ini to my local ipv4 address, it made no difference. I also tested different ports. Of course I always restarted apache after changing something in the php.ini.
I am using Windows 10 Pro 64 bit and Chrome.
Any ideas? Thanks in advance for any help!
More:
I checked my firewall, the port is not being blocked.
I was able to solve it thanks to @LazyOne's hint. After checking the logs I found out, that netbeans tried to connect to random ip addresses:
Log opened at 2018-04-10 21:14:12
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Remote address found, connecting to 74.84.178.15:9001.
E: Time-out connecting to client (Waited: 200 ms). :-(
Log closed at 2018-04-10 21:14:12
Log opened at 2018-04-10 21:17:27
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Remote address found, connecting to 212.112.65.234:9001.
E: Time-out connecting to client (Waited: 200 ms). :-(
Log closed at 2018-04-10 21:17:27
Log opened at 2018-04-10 21:19:22
I: Checking remote connect back address.
I: Checking header 'HTTP_X_FORWARDED_FOR'.
I: Remote address found, connecting to 57.101.242.52:9001.
E: Time-out connecting to client (Waited: 200 ms). :-(
Log closed at 2018-04-10 21:19:22
I instantly knew that this has something to do with the chrome extension ipflood
which is changing the ip addresses randomly. It works after disabling it!