1

Is there a way to run current *.php file as PHP script from within Visual Studio Code? Information I've found suggests you can debug code if you install Xdebug but it feels weird you can't just run code.

(This was a standard feature in all editors around year 2000 but it's becoming harder to find nowadays...)

1 Answer 1

3

I'd say the editor doesn't have such feature because there's a third-party extension that implements it...You need to install Runner. Then, Ctrl+Shift+R launches the script in the Output pane:

screenshot

PHP is configured out of the box:

const defaultLanguageMap = {
  bat: '',
  clojure: 'clj',
  go: 'go run',
  javascript: 'node',
  lua: 'lua',
  perl6: 'perl6',
  perl: 'perl',
  php: 'php',
  powershell: 'powershell -noninteractive -noprofile -c -',
  python: 'python',
  r: 'Rscript',
  ruby: 'ruby',
  shell: 'bash',
  typescript: 'tsc'
};
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.