/bin/sh: 1: C:xamppphpphp.exe: not found
P粉691958181
P粉691958181 2024-03-31 09:10:37
0
1
421

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粉691958181
P粉691958181

reply all(1)
P粉391677921

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!