[SOLVED] Running & Debugging PHP through Linux Bash Subsystem on Windows 10

I am developin on Windows 10 machine, and wanted to use Linux PHP binary in Bash on Ubuntu on Windows (WSL subsystem) directly for running scripts and debugging from inside PhpStorm.

I created a proxy scripts that let PhpStorm think that PHP binary is installed on the system. But in the background, they start the PHP inside the Windows Bash and forward everything to it. Also XDebug is working.

Maybe you could enjoy this little helper as well :-) And if you had time to write me a feedback, I would be more than happy.

> Download: https://github.com/michal-kocarek/PhpOnWindows

1 comment
Comment actions Permalink

Why is this needed - am I missing something subtle....?

If under WSL you set the following in your php.ini:


zend_extension="<path to your xdebug.so"



Then add the XDEBUG_SESSION_START query param to your http request for the file you wish to debug, as long as you have opened port 9000 for incoming traffic in the Windows Firewall everything works just fine. Just configure PhpStorm to use a remote server with local source files, make sure you have listening turned on, and you're good to go. This way you can use postman to make your requests for API debug too. 

You can use COOKIES instead of the XDEBUG_SESSION_START query param if preferred and there are browser extension to help with that.

Nick Weavers



Please sign in to leave a comment.