debug wordpress using php tools in VS2013
11 posts
• Page 1 of 2 • 1, 2
debug wordpress using php tools in VS2013
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?
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
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
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: debug wordpress using php tools in VS2013
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:
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.
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
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,
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: debug wordpress using php tools in VS2013
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.
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
It makes sense. We'll do it!
Thanks,
Thanks,
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: debug wordpress using php tools in VS2013
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!
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: debug wordpress using php tools in VS2013
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
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
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
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. │ @miloslavbeno │ miloslav@devsense.com
-
Miloslav Beno - Posts: 1252
- Joined: January 7th, 2012, 8:36 pm
Re: debug wordpress using php tools in VS2013
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
11 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 11 guests