If you have had any trouble, like I have,setting up a debugger with Vagrant, this article will hopefully reduce some strain on your weary head.
1) Get your VVV Vagrant box setup. All the documentation is online straightforward and useful.
https://github.com/Varying-Vagrant-Vagrants/VVV
2) Here is where I come in. This next 2 steps are reversable. Install PHP Tools, this might be an optional step but works for the way that I've done it in the past.
3) Make sure you create a project sln in Visual Studio. Make sure your project is a php project so go to your existing vagrant project File → New Project → New project from existing code.
3) For your project solution, Select the www/wordpress-default or with Vagrant 2 you will select www/wordpress-default/public_html project or where ever you have your project setup with git.
4) You vagrant box will have xdebug on, if not SSH into your box and turn Xdebug_on, you will have to repeat this process everytime the vagrant box is turned off.
5) Right click into your project, not your project solution and select properties. (Shown in the image above.
6)Now in the application tab fill out the start url to be the one associatd with your vagrant box, we use the defaulted http://local.worpdress.dev or whatever current page you want. I use this with the xdebug extension for chrome. Just make sure you turn on the chrome extension on when you want to debug. https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en

1) Get your VVV Vagrant box setup. All the documentation is online straightforward and useful.
https://github.com/Varying-Vagrant-Vagrants/VVV
2) Here is where I come in. This next 2 steps are reversable. Install PHP Tools, this might be an optional step but works for the way that I've done it in the past.
3) Make sure you create a project sln in Visual Studio. Make sure your project is a php project so go to your existing vagrant project File → New Project → New project from existing code.
3) For your project solution, Select the www/wordpress-default or with Vagrant 2 you will select www/wordpress-default/public_html project or where ever you have your project setup with git.
4) You vagrant box will have xdebug on, if not SSH into your box and turn Xdebug_on, you will have to repeat this process everytime the vagrant box is turned off.
5) Right click into your project, not your project solution and select properties. (Shown in the image above.
6)Now in the application tab fill out the start url to be the one associatd with your vagrant box, we use the defaulted http://local.worpdress.dev or whatever current page you want. I use this with the xdebug extension for chrome. Just make sure you turn on the chrome extension on when you want to debug. https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
7) Now on the server tab we set the our path mappings and our xdebug port. Our vagrant xdebug port should b setup to 9000 as a default so we use that and we fill in our file directory to our local drive and the absolute path for the path on our server(nginex) drive.
These paths have to correspond with your local drive and what your server path will be. So with Vagrant 2, you will need.
File/directory: C:\ProjectFolder\www\wordpress-default\public_html
Absolute path: on server: /srv/www/wordpress-default/public_html
9) And that should be it, set a breakpoint within visual studio and hit the run button. The browser should open up and you will have to navigate to the page, ie local.wordpress.dev, manually. Open up your locals window and a breakpoint should be hit.
Run Button
What should be running
Comments
Post a Comment