formulahendry/vscode-code-runner
Bash on Ubuntu on Windows php problem
Ouverte
#105 ouverte le 18 avr. 2017
help wanted
Métriques du dépôt
- Stars
- (2 408 étoiles)
- Métriques de merge PR
- (Métriques PR en attente)
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?