It all works - except debug

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

It all works - except debug

Postby kev1nd » December 25th, 2012, 12:35 pm

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
kev1nd
 
Posts: 5
Joined: December 24th, 2012, 6:53 pm

Re: It all works - except debug

Postby Miloslav Beno » December 25th, 2012, 2:20 pm

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
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: It all works - except debug

Postby kev1nd » December 26th, 2012, 11:08 am

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.
kev1nd
 
Posts: 5
Joined: December 24th, 2012, 6:53 pm

Re: It all works - except debug

Postby kev1nd » December 26th, 2012, 11:44 am

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).
kev1nd
 
Posts: 5
Joined: December 24th, 2012, 6:53 pm

Re: It all works - except debug

Postby Miloslav Beno » December 26th, 2012, 1:53 pm

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?
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: It all works - except debug

Postby kev1nd » December 26th, 2012, 3:28 pm

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
kev1nd
 
Posts: 5
Joined: December 24th, 2012, 6:53 pm

Re: It all works - except debug

Postby Miloslav Beno » December 26th, 2012, 4:03 pm

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.
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: It all works - except debug

Postby kev1nd » December 27th, 2012, 5:33 pm

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.
kev1nd
 
Posts: 5
Joined: December 24th, 2012, 6:53 pm

Re: It all works - except debug

Postby Miloslav Beno » December 27th, 2012, 6:04 pm

Great, I'm glad it worked!

Thank you for feedback.
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: It all works - except debug

Postby CFI » December 28th, 2012, 8:41 am

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.
CFI
 
Posts: 66
Joined: December 13th, 2012, 1:29 pm

Next

Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 43 guests

cron

User Control Panel

Login

Who is online

In total there are 43 users online :: 0 registered, 0 hidden and 43 guests (based on users active over the past 5 minutes)
Most users ever online was 297 on March 29th, 2024, 7:06 am

Users browsing this forum: No registered users and 43 guests