I am trying to run PHP code on Microsoft VS Code. When I click launch the only thing that happens is an error in the debug console saying:
spawn php ENOENT
To fix this, I have put the dll file for XDebug into the ext folder. I copied php.ini-development into a new file called php.ini and in that file I added this to the end of the file.
zend_extension="[file path]" xdebug.remote_enable = 1 xdebug.remote_autostart = 1
This changed nothing.
Then, I added an inbound rule for my firewall to allow inbound connections on port 9000. Still, nothing changed. How can I fix this?
Advertisement
Answer
What fixed it for me, was adding this line to user settings:
"phpserver.phpPath": "c:\Ampps\php-7.1\php.exe"
Your path may vary. (-> error occurs, because your php is not found)
phpserver: This is because I use the PHP Server extension. If you use a different extension, you need a different parameter.