PHP validation in Visual Studio Code

To develop a WordPress plugin, I use Visual Studio code. While developing I realized that development is easier if Visual Studio Code supports: highlighting PHP syntax; IntelliSense (code completion); Linting (analyzing code), etc. This blog describes how to configure PHP validation settings in Visual Studio Code.

Before PHP validation was set up, I received the following error:

Cannot validate the PHP file. The PHP program was not found.

Use the ‘php.validate.executablePath’ setting to configure the location of ‘PHP’

Fix: In Visual Studio Code go to: File > Preferences > Settings > User settings: PHP

Next click on the “edit in settings.json” and add/change the following:

  • "php.validate.executablePath": "C:\\php\\php.exe"

See also Visual