[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
Please sign in to leave a comment.
Why is this needed - am I missing something subtle....?
If under WSL you set the following in your php.ini:
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
Hi Michal
Seems like your script stopped to work on more recent PHPStrorm versions: https://monosnap.com/file/VopVaJoaOamYvHLmnxYI9BCgHPN2j7
Wondering if you can have a look and adjust the script?
I've been searching for a solution to run xdebug from WSL for a while now but this one looks like the best idea.