debug wordpress using php tools in VS2013

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

debug wordpress using php tools in VS2013

Postby ingyukoh » December 3rd, 2013, 3:25 am

I create a new project from wordpress theme by "File|New|Project from existing code"
and selecting PHP. I give a project name "wordpress" and source folder to "C:\xampp\apps\wordpress\htdocs\wp-content\themes\twentythirteen".

can I include wp-admin, wp-content,wp-includes?
ingyukoh
 
Posts: 2
Joined: December 3rd, 2013, 3:14 am

Re: debug wordpress using php tools in VS2013

Postby Miloslav Beno » December 3rd, 2013, 8:50 am

Hello,

The easiest way would be to just to include whole wordpress into your project. This way it won't be an issue to run/debug it.

If you want your theme as separate project, it is possible also. Have one project for your theme and another one for wordpress. Reference wordpress from wordpress theme and set it up to be published on run to actual wordpress. As a startup project setup the wordpress. This way it would work as you'd expect.

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

Re: debug wordpress using php tools in VS2013

Postby acordero » December 30th, 2013, 3:51 pm

Hi. I am too having problems with this.

When debugging, the output window warns me that no mapping has been set up ("There wasn't established any directory mapping. Debugging most likely won't work correctly."), and breakpoints do not break. It's probably due to how i have set up my project (a WordPress plugin).

Remote debugging connects properly. The xdebug log shows the connection is made, but the line with the breakpoint has an incorrect local path (it shows the development path instead).

This is what i have:

  • * Remote IIS with WordPress
  • * Local drive mapped to remote home directory as to publish the files from VS using filesystem method.
  • * Solution has two projects: main project is the directory of the plugin (development sources), second project is the remote WP home through the mapped directory. Main project references second project as to get proper intellisense.
  • * Both projects configured to use Custom Web Server, with Server Url pointing to the appropiate url for each one. Main project is also configured to publish before run and it is set as the Startup project. Both projects launch a common url on launch (home), since i have to manually navigate to some WP page that uses this plugin (it is a shortcode plugin).

Can this mapping issue be fixed? Maybe adding an option to the project to set up the correspondence between the project source and the (unknown to the debugger) remote path?

Thanks.
acordero
 
Posts: 2
Joined: December 30th, 2013, 3:28 pm

Re: debug wordpress using php tools in VS2013

Postby Miloslav Beno » December 30th, 2013, 5:17 pm

Hi there,

Thanks for detailed feedback. We're most likely going to add manual path mapping for debugger in case automatic mapping can't figure it out.

Anyway for your case, maybe it would help to setup as startup project the one with the actual wordpress sources? If I understand correctly you do publish it too?

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

Re: debug wordpress using php tools in VS2013

Postby acordero » December 30th, 2013, 6:31 pm

No, the WordPress project is only used for intellisense so i load it directly from the WebServer (does not get published). Putting it as Startup doesn't work either.

I will try using only one project with the full WordPress site, but i eagerly await for those changes you talk about, since i prefer to have my plugins in an independent project for clarity.
acordero
 
Posts: 2
Joined: December 30th, 2013, 3:28 pm

Re: debug wordpress using php tools in VS2013

Postby Miloslav Beno » January 2nd, 2014, 2:35 pm

It makes sense. We'll do it!

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

Re: debug wordpress using php tools in VS2013

Postby Miloslav Beno » September 2nd, 2014, 11:16 am

Hello,

1.14 introduced reference property SubPath, which can be used to instruct debugger to map paths according to references. In a sense it's doing what would you expect from manual mapping.

E.g.

WP Plugin
- Ref: Wordpress (so intellisense works)
WordPress
- Ref: WP Plugin with SubPath "wp-content/plugins/WPPlugin"

This way when you run WordPress project the debugger will map paths correctly from REMOTE_SYSTEM/wp-content/plugins/WPPlugin to WP Plugin project directory. So you can have breakpoints in your plugin project.

Please give me know if that makes sense for your situation or if you'd need any help to configure this.

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

Re: debug wordpress using php tools in VS2013

Postby dwaynedriskill » September 29th, 2014, 6:53 pm

I am also having trouble debugging WordPress using php tools in VS2013. Although, it sounds like I'm having a different problem.
Here is some info:
Debugging works when I have the project set to 'Use Local IIS Express' set to http://localhost:63946/.
Debugging does not work when I set the project to 'Use Custom Web Server' set to http://mywordpresssite.com/.

When I say that 'Debugging works' I mean that I can set break points and VS will break on them.

I have a hosts file entry which points mywordpresssite.com to my local machine:
127.0.0.1 mywordpresssite.com

'xdebug' does not appear here (which is probably the issue):
https://mywordpresssite.com/phpinfo.php

When I run my project in VS2013, I see this message in the Output window:
Auto-attach to process '[6612] PHP.Debugger.Systray.exe' on machine 'myMachineName' succeeded.

I'm using IIS on Windows 7 (x64) which is using C:\program files (x86)\php\v5.6nts32\php.ini

I followed the instructions for configuring XDebug at http://www.devsense.com/doc/phptools/de ... ing-xdebug

Here's the XDebug section from my php.ini:
[XDebug]
zend_extension = "C:\Program Files (x86)\PHP\v5.6NTS32\ext\php_xdebug-2.2.5-5.6-vc11-nts.dll"
xdebug.default_enable=on
xdebug.remote_enable = on
xdebug.remote_autostart=off
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9001
xdebug.remote_mode = req
xdebug.idekey="php-vs"

Visual Studio is configured to use port 9001. I've also tried port 9000 with the same results.

I have a license for PHP tools, but it's under my boss' email address.
Thanks.

Dwayne
dwaynedriskill
 
Posts: 4
Joined: September 29th, 2014, 6:41 pm

Re: debug wordpress using php tools in VS2013

Postby Miloslav Beno » October 1st, 2014, 12:23 pm

Hi Dwayne,

The issue is( as you've mentioned ) php not loading xdebug. That might have various reasons. Usually it's incorrect version of xdebug. Which In your case looks it's ok or there might be other php.ini file which is picked up and not using your intended configuration, take a look at that phpinfo what's actual php.ini used. There might be PHP_RC environment variable pointing to the different php.ini

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

Re: debug wordpress using php tools in VS2013

Postby dwaynedriskill » October 1st, 2014, 1:50 pm

I got it working. My PATH had 2 old versions of php. I removed the old versions of PHP, removed the entries from my PATH and recycled IIS and then debugging started working. Thanks. That's a big help.
dwaynedriskill
 
Posts: 4
Joined: September 29th, 2014, 6:41 pm

Next

Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 11 guests

cron

User Control Panel

Login

Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 5 minutes)
Most users ever online was 787 on May 12th, 2024, 11:50 am

Users browsing this forum: No registered users and 11 guests