Feb 9, 2015

f Comment

Fixing PHP Eclipse IDE's "Waiting For Xdebug Session 57%" Problem in SECONDS!

Amazon If you use Eclipse to develop PHP and you want to be able to run the PHP debugger called XDebug, you may encounter the following error:

Progress view:
Launching about-this-website.php
A progress bar stopping at 57%
Launching : waiting for XDebug session

In Eclipse in Debug view, when you run a debug session, you will see that the targeting PHP page instantly loads in the Internal Web Browser view regardless of the breakpoints you have set.

Why? How do you fix it so that XDebug will stop at the breakpoints when you run XDebug debugger?

I use Eclipse for PHP Developers version 3.0.2, PHP version 5.3.13, XDebug version 2.2.0.

Solution

First you need to know how the Xdebug debugger works. Xdebug is a piece of software that runs and listens on a specific port, which you set in Eclipse by going to Window -> Preferences -> PHP -> Debug -> Installed Debuggers. In my case, I have Zend Debugger and XDebug. They each have a port configured for it. You must set a port for each debugger. For XDebug debugger, let's say you set the port to be 10000.

Second, your PHP engine needs to know this port in order for the PHP engine to communicate with the Xdebug debugger. To set it, simply make sure you have the following lines in your PHP configuration file, which is often called php.ini:
zend_extension = "c:/wamp2.2/bin/php/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9-x86_64.dll"

[xdebug]
xdebug.remote_enable = On
xdebug.remote_port=10000

By the way, php_xdebug-2.2.0-5.3-vc9-x86_64.dll is a Zend extension which you can download from the Internet. If you use WAMP they may already have this extension in their folder.

So basically, your XDebug's port must match the value of xdebug.remote_port in php.ini.

Restart PHP. Run XDebug debugger again. Your PHP debugger should stop at the breakpoints now.

Questions? Let me know!
Please leave a comment here!
One Minute Information - by Michael Wen
ADVERTISING WITH US - Direct your advertising requests to Michael