Well , Everyone has added their answer but I will add one more thing that the chosen answer didn't update.
You can add multiple php executables now ( if code runner extension installed )
A similar issue was pointed out in vscode's github repo #128098 and in #131534 and it was addressed after
VS Code version: 1.59.1 [3866c35]
Release Date : 19th August 2021 or 2021-08-19T11:57:20.140Z
Anyway, so you can now :
- add your multiple versions/installations of php by clicking on the bottom status bar of vscode, specifically on the version of php you are running ( in this example it is 7.4.3)
- or by editing the code runner extension settings in
settings.json
(both point to the same file)
settings.json
File path in windows and samplecontents:
C:\Users\{Your Name}\AppData\Roaming\Code\User\settings.json
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"vsicons.dontShowNewVersionMessage": true,
"debug.onTaskErrors": "showErrors",
"redhat.telemetry.enabled": false,
"[cpp]": {
"editor.wordBasedSuggestions": true,
"editor.suggest.insertMode": "replace",
"editor.semanticHighlighting.enabled": true
},
"security.workspace.trust.untrustedFiles": "open",
"totalTypeScript.hideAllTips": false,
"totalTypeScript.hideBasicTips": false,
"files.associations": {
"*.inc": "php"
},
"php.executables": {
"7.4.3":"C:\\xampp\\php\\php.exe",
"8.1":"C:\\xampp\\php8\\php.exe"
}
}
Just add
"php.executables": {
"7.4.3":"C:\\xampp\\php\\php.exe"
}
Or
"php.executables": {
"7.4.3":"C:\\xampp\\php\\php.exe",
"8.1":"C:\\xampp\\php8\\php.exe"
}
at the bottom of your settings.json
file in vs code