Xdebug on WSL

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

Xdebug on WSL

Postby Disclosure » March 9th, 2018, 5:25 pm

I have been trying to use nginx and php-fpm on a local windows machine in a linux subsystem, which seems to work well enough after some tweaking, however xdebug did not seem to work off the bat, although the settings appear to be correct, I adjusted the directory mapping and all that.

No joy, however.

Did anyone manage to get it working on WSL?
Disclosure
 
Posts: 29
Joined: September 21st, 2015, 6:37 pm

Re: Xdebug on WSL

Postby Disclosure » March 9th, 2018, 6:09 pm

Both VS PHP debugger and both appear to be listening on port 9000:

xdebug-phpinfo.png


However they are not making a connection.

Edit: actually a correction, that is php-fpm listening on 9000 for connections from nginx. I changed the xdebug port to 8000 but it did not appear in the list.
You do not have the required permissions to view the files attached to this post.
Disclosure
 
Posts: 29
Joined: September 21st, 2015, 6:37 pm

Re: Xdebug on WSL

Postby Miloslav Beno » March 12th, 2018, 11:03 am

Hello,

Thanks for the post.

xdebug.remote_port setting has to be the same as in PHP Tools options (in Visual Studio, Tools | Options | PHP Tools | Advanced). The default value is 9000 and it is usually enough just to leave it as it is.

This other process php-fpm blocks port 9000. Change Xdebug port to 9001 both in php.ini and in Visual Studio settings. Note that restarting nginx will not reload php.ini! You will need to restart the server.

Please let me know if that helped.

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

Re: Xdebug on WSL

Postby Disclosure » March 20th, 2018, 9:29 am

Hi Miroslav,

I have tried that, and a number of other things, unfortunately, that did not help. I think there is something up with WSL environment as it seems like when a connection to nginx is made, xdebug is not making a connection back, TCPView does not register it spawning at the port specified. There is also a bunch of not very descriptive errors in php-fpm's log, although that may be not related.

I fell back to using a VM for now, hopefully they will be able to put WSL into a proper shape soon enough. It mostly works, except this strange issue with xdebug.
Disclosure
 
Posts: 29
Joined: September 21st, 2015, 6:37 pm

Re: Xdebug on WSL

Postby Miloslav Beno » March 22nd, 2018, 9:46 am

Hi,

Thank you for trying this and providing us with your findings. Let us also try WSL, it's interesting use case! We will get back with whatever we find.

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

Re: Xdebug on WSL

Postby Miloslav Beno » April 26th, 2018, 12:24 pm

Hi guys,

I've written tutorial on how to setup Windows Linux Subsystem for Linux for PHP projects on Visual Studio. I hope it will be useful for somebody.

https://blog.devsense.com/2018/04/wsl

Cheers!
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 48 guests

cron

User Control Panel

Login

Who is online

In total there are 48 users online :: 0 registered, 0 hidden and 48 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 48 guests