search

Home  >  Q&A  >  body text

/bin/sh: 1: C:xamppphpphp.exe: not found

I'm using WSL2, Ubuntu 20.04 and running VSCode. I'm using the Code Runner extension with VSCode and XAMPP on Windows

I set the path of php.exe in Windows environment variables.

I have the following in my VSCode settings.json in the code runner

"code-runner.executorMap": {
        "javascript": "node",
        "php": "C:\xampp\php\php.exe",
        "python": "python",
        "perl": "perl",
        "ruby": "C:\Ruby23-x64\bin\ruby.exe",
        "go": "go run",
        "html": "\"C:\Program Files\Mozilla Firefox\firefox.exe\"",
        "java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
        "c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
    },

I have a program called index.php in the editor. I right-clicked in the VSCode editor and selected "Run Code"

In the output window of the VSCode terminal, I receive the following error message:

[Running] C:\xampp\php\php.exe "/home/johnr/xproj/index.php"
/bin/sh: 1: C:xamppphpphp.exe: not found

[Done] exited with code=127 in 0.039 seconds
  1. Why do I get error messages?
  2. Why does the path in the bin statement not show the slash between directories (C:xamppphpphp instead of C:\xampp\php\php.exe)?

I tried various configuration changes based on Google search results, but nothing changed this error message.

Unless I change sh dash to sh bash and get this message

[Running] C:\xampp\php\php.exe "/home/johnr/xproj/index.php"
/bin/sh: C:xamppphpphp.exe: not found

[Done] exited with code=127 in 0.039 seconds

The only difference is 1: does not exist after /bin/sh:

P粉691958181P粉691958181237 days ago453

reply all(1)I'll reply

  • P粉391677921

    P粉3916779212024-04-01 07:40:07

    I think WSL requires a Unix-like path, so for example your php path should be

    "php": "/mnt/c/xampp/php/php.exe",

    instead of

    "php": "C:\\xampp\\php\\php.exe",

    The same situation may apply to ruby.

    reply
    0
  • Cancelreply