Setup VS Code for PHP

  1. Install VS COde
  2. Install or copy PHP executable https://www.php.net/downloads
  3. Add some Json files in Settings of VS code. (navigate to File -> Preferences -> Settings)
  4. Click on “Open Json settings button on top right side icon” It will open settings.json file
  5. Paste following code block in it, correct the runtime execuatable file path accordingly.
{
    "launch": {
        "configurations": [
            {
            "type": "php",
            "request": "launch",
            "name": "Run using local PHP Interpreter",
            "program": "${file}",
            "runtimeExecutable": "C:\\php\\php.exe"
            }],
        }
    
}

6. Now install the extension, go to the extension tab in VS Code and search “PHP” install PHP Debug by Felix Becker, Now VS code is ready to execute PHP in VS Code.

Note: if you don’t want to use VS Code to run PHP code, you can also use online editor Implode https://implode.io/

Leave a Reply

Your email address will not be published. Required fields are marked *


two + 3 =