Page 1 of 2

It all works - except debug

PostPosted: December 25th, 2012, 12:35 pm
by kev1nd
I've just installed PHP Tools and XDebug into Visual Studio 2012 Ultimate. All the features seems to work - except debug. I can set a stop (i.e. F9) but it just doesn't hit it.

The Visual Studio Options dialog seems happy with the configuration, and the PHP debugger pops up a notification that it's starting when I start (F5) the code.

If I create a new, default, PHP project - then put a stop on the "hello world" line - the project will run fine, but doesn't hit the stop.

I'd appreciate any advice, thanks

Re: It all works - except debug

PostPosted: December 25th, 2012, 2:20 pm
by Miloslav Beno
Hello,

Thank you for contacting us. Could you please provide me with more information?

- What project properties do you have? Do you use custom server or PHP 5.4 builtin or IIS Express?

If you use custom server PHP tools leave configuration on the user.

What you can try is to create a file with phpinfo(); and run it. Do you see XDebug there? If you don't it means XDebug wasn't loaded by PHP runtime. Therefore can't comunicate with PHP Tools. If that's the case we can take a look to your PHP configuration.

Thank you

Re: It all works - except debug

PostPosted: December 26th, 2012, 11:08 am
by kev1nd
Thanks for the quick response.

I'm using the PHP Build-in Server, with auto-assign port "on".
PHP is version 5.4, installed in "C:\Program Files (x86)\IIS Express\PHP\v5.4". I needed to open up security on the folder to get it working. PHP 5.2 and 5.3 are installed in parallel folders, though not selected.

PHP "advanced" mentioned XDebug on port 9000
The "Interpreter" option mentions PHP 5.4.10 (with built-in web server support).
The PHP path is "C:\Program Files (x86)\IIS Express\PHP\v5.4" (i.e. the same) and the configuration file is "C:\Program Files (x86)\IIS Express\PHP\v5.4\php.ini"
Debugging is "XDebug xdebug.remote_port => 9000"

In the php.ini file, I added a line:
zend_extension = "C:\Program Files (x86)\IIS Express\PHP\v5.4\ext\php_xdebug-2.2.1-5.4-vc9-nts-x86_64.dll"
When I did this, the PHP options dialog suggested some updates to php.ini, all of which I accepted. I think they were these:-
[XDEBUG]
xdebug.remote_enable = on
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000

Looking at this, I notice have a 64-but extension in a subdirectory of a 32-bit application - is that going to be a problem? (pc is 64-bit)

Finally, running netstat-o in the command line doesn't show any processes on port 9000. PHP debugger does start, it's icon is in the task tray.

Re: It all works - except debug

PostPosted: December 26th, 2012, 11:44 am
by kev1nd
Update:
I installed the 32-bit thread safe version of xdebug, and it worked - but only once.
If I run it a second time, I get a warning message from Visual Studio: "Only one usage of each socket address (protocol/network/address/port) is normally allowed". The project fails to run (no response from web server) if I ignore the warning and re-start the project in debug.
If I force the PHP debugger to exit (right-click task-tray icon), and then run without debug (CTRL-F5), the project will run.
If close Visual Studio, and re-start it, then the project will run in debug for one time only (second time gives same error message).

Re: It all works - except debug

PostPosted: December 26th, 2012, 1:53 pm
by Miloslav Beno
Hi Kevin,

Thank you very much for detailed information.

64bit Xdebug is frequent issue. We'll make some rule that recognize this settings. Basicaly with oficial distribution of PHP on Windows, users always have to use 32bit version of XDebug.

The other issue you've been experiencing might be cause by thread safe version of XDebug. Could you please try non thread safe?

Re: It all works - except debug

PostPosted: December 26th, 2012, 3:28 pm
by kev1nd
Hi

I tried the non thread safe (32 bit) version. I got a message saying "the program could not start because php5.dll is missing from your system".

I checked the php directory, and it contains php5ts.dll but not php5.dll. Do I need to grab a different version of PHP as well?

Thanks

Re: It all works - except debug

PostPosted: December 26th, 2012, 4:03 pm
by Miloslav Beno
I see, please grab non-thread safe version of PHP as on Windows it's recommended to use this distribution.

However I'll plan testing on thread safe version to see if we can replicate the issue you've been having.

Re: It all works - except debug

PostPosted: December 27th, 2012, 5:33 pm
by kev1nd
That worked, thanks for the help.

In summary, I needed to configure the non-thread-safe versions of PHP (5.4), XDebug and PHP Tools for Visual Studio. I'm using VS 2012 Ultimate.

With this in place, I can run and debug PHP programs in VS.

Re: It all works - except debug

PostPosted: December 27th, 2012, 6:04 pm
by Miloslav Beno
Great, I'm glad it worked!

Thank you for feedback.

Re: It all works - except debug

PostPosted: December 28th, 2012, 8:41 am
by CFI
Just FYI:
I am running PHP 5.3 Thread-Safe and XDebug 2.2.1 and debugging also works fine for me (VS 2012). So it is not a general problem with the TS version.