Why is Visual Studio Code showing user preferences instead of running a PHP file?

I noticed that in Visual Studio Code there is a menu item "Start without debugging" in the menu "Debug". When I open the PHP file, I expected it to run the PHP file through the PHP executable and give me the result. Instead, when I click "Start without debugging," the "User Settings" page appears. Why does the user settings page appear? It is not clear why this page is presented to me. Does he want me to tune something? How can I make it just run the PHP file that I open through the PHP executable? Is it possible?

I noticed that the default setting has the property "php.validate.executablePath" , which is set to null . I tried to override this parameter in user settings, pointing it to the path of my PHP executable as follows:

 { "php.validate.executablePath": "/usr/bin/php" } 

But that didn’t solve anything. The User Settings page is still displayed when I click on "Start without debugging."

+7
php configuration visual-studio-code
source share
1 answer

After doing more research, I found a solution to my problem. Based on this section in the vscode docs and this comment that mentions creating a global launch configuration, all you have to do is add the launch object to your JSON user settings.

In my case, I added this to my user settings:

 "launch": { "version": "0.2.0", "configurations": [ { "type": "php", "request": "launch", "name": "Launch Program", "program": "${file}", "runtimeExecutable": "/usr/bin/php" } ] } 

Your value for runtimeExecutable may differ depending on the path to the PHP executable.

+4
source share

All Articles