formulahendry / formulahendry/vscode-code-runner
Bash on Ubuntu on Windows php problem
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 351
- PR merge metrics
- No merged PRs in 30d
Description
I've tried using PHP, installed in the Ubuntu subsystem on Windows 10, but it works partially.
I create the php.cmd file in PATH, which redirects the PHP command from the command line to bash Ubuntu (after replacing `C:\` with `/mnt/c/`, replacing `\` with `/` and escaping `"` characters).
php.cmd:
```
@ECHO off
SET cmd=%*
SET cmd=%cmd:C:\=/mnt/c/%
SET cmd=%cmd:\=/%
SET cmd=%cmd:"=\"%
SET cmd=C:\Windows\System32\bash.exe -c "php %cmd%"
CALL %cmd%
```
This allows me to call from the command line (Windows) any php command (php -v; php "path_to_file").
However, this does not work with the code-runner, it outputs:
```
[Running] php "c:\temp\test.php"
"C:\Windows\System32\bash.exe" is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 0.028 seconds
```
In Windows shell (cmd, powershell) command `php "c:\temp\test.php"` works fine.
What could be the reason?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.