Debugging with Custom Web Server

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

Debugging with Custom Web Server

Postby codeowl » March 21st, 2013, 2:11 am

Hi Guys,

I was wanting to get PHP Tools Debugging with WAMP.

I have installed WAMP SERVER (32BITS & PHP 5.4) 2.2E
(Apache 2.2.22 – Mysql 5.5.24 – PHP 5.4.3 XDebug 2.1.2 XDC 1.5 PhpMyadmin 3.4.10.1 SQLBuddy 1.3.3 webGrind 1.0)

I have then placed php_xdebug-2.2.1-5.4-vc9-nts.dll in the WAMP PHP ext directory.

When I search my PHP.ini file the only xdebug I find is the following:
; XDEBUG Extension
zend_extension = "C:\wamp\bin\php\php5.4.3\ext\php_xdebug-2.2.1-5.4-vc9-nts.dll"
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.idekey="php-vs"

In my VS PHP Project properties I have my project set to Use Custom Web Server, and have it pointed to the localhost path of the site.

Apache is serving up the site no problems, and when I play the project in VS is launches the site, however on a simple index.php page with one line:
<?php echo phpinfo(); ?>
my break point is not hit.
If I change the project option to Use PHP built-in Web Server, it works fine, and the break point is hit.

Also I have noticed that when I run the project using the PHP built-in Web Server the phpinfo() output shows a dedicated section to xdebug.
However when using Custom Web Server, there is no dedicated xdebug section in the phpinfo() output, so it appears that for some reason xdebug is not being loaded.

How can I get it to work with WAMP?

Regards,

Scott
codeowl
 
Posts: 51
Joined: February 10th, 2013, 10:05 am

Re: Debugging with Custom Web Server

Postby Miloslav Beno » March 21st, 2013, 2:18 pm

Hi Scott,

I don't use WAMP so I'll just write what I guess it might be. If phpinfo doesn't show xdebug, that just means wamp wasn't able to load it up for some reason.

Here are some thoughts:
- check the XDebug path in php.ini, is the name of xdebug dll correct?
- maybe WAMP wants thread safe version of xdebug?
- is the php.ini you are altering the one wamp loads?
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: Debugging with Custom Web Server

Postby codeowl » March 21st, 2013, 11:49 pm

Miloslav,

Thanks for the response mate. I got it sorted.

For the benefit others trying to get php dev environment working with VS/PHP Tools/WAMP here's how I solved it:

I had a simple <?php echo phpinfo(); ?> index.php page in a project that was set to use custom web server and pointed to the index.php page in the location: c:\wamp\www\testProject\index.php

I ran this up and (note if you have IIS installed you will need to stop that, before apache will serve up the page ;-)), and then on the rendered page, did a Ctrl+A Ctrl+C and copied the phpInfo() output and pasted it into the following page:
http://xdebug.org/wizard.php

This provided the following instructions:

Tailored Installation Instructions

Summary

Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: yes - Compiler: MS VC9 - Architecture: x86
Zend Server: no
PHP Version: 5.4.3
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: yes
Configuration File Path: C:\Windows
Configuration File: C:\wamp\bin\apache\apache2.2.22\bin\php.ini
Extensions directory: c:\wamp\bin\php\php5.4.3\ext
Instructions

Download php_xdebug-2.2.1-5.4-vc9.dll
Move the downloaded file to c:\wamp\bin\php\php5.4.3\ext
Edit C:\wamp\bin\apache\apache2.2.22\bin\php.ini and add the line
zend_extension = c:\wamp\bin\php\php5.4.3\ext\php_xdebug-2.2.1-5.4-vc9.dll
Restart the webserver


This told me that I had two PHP.ini files, as the one I had been working with was in C:\wamp\bin\php\php5.4.3\php.ini

Maybe this explains why it worked when using the built in web server, but not when using apache.

So I edited both of these php.ini files and put the following in them:
Code: Select all
; XDEBUG Extension
zend_extension = "c:\wamp\bin\php\php5.4.3\ext\php_xdebug-2.2.1-5.4-vc9.dll"
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = localhost
xdebug.remote_port = 9000
xdebug.remote_mode = req
xdebug.idekey="php-vs"

And of course I made sure I had the php_xdebug-2.2.1-5.4-vc9.dll in the correct dir.

Then I restarted the apache service using WAMP, and restarted the VS Project, and my break points are now hit when using PHP & Apache via WAMP.

Hopefully this will save someone else some time ;-)

Regards,

Scott
codeowl
 
Posts: 51
Joined: February 10th, 2013, 10:05 am

Re: Debugging with Custom Web Server

Postby Miloslav Beno » March 24th, 2013, 11:39 pm

Scott,

Thank you very much for sharing this experience with us. I'm sure it will help a bunch of people.

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


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 41 guests

cron

User Control Panel

Login

Who is online

In total there are 41 users online :: 0 registered, 0 hidden and 41 guests (based on users active over the past 5 minutes)
Most users ever online was 256 on March 28th, 2024, 9:42 am

Users browsing this forum: No registered users and 41 guests