Microsoft VS Code:当我尝试启动我的程序时出现错误“spawn php ENOENT"出现 [英] Microsoft VS Code: When I try to launch my program error "spawn php ENOENT" shows up

查看:39
本文介绍了Microsoft VS Code:当我尝试启动我的程序时出现错误“spawn php ENOENT"出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Microsoft VS Code 上运行 PHP 代码.当我点击启动时,唯一发生的事情是调试控制台中的错误:

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:

生成 php ENOENT

spawn php ENOENT

为了解决这个问题,我将 XDebug 的 dll 文件放到了 ext 文件夹中.我将 php.ini-development 复制到一个名为 php.ini 的新文件中,并在该文件中将其添加到文件末尾.

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

这没有任何改变.

然后,我为我的防火墙添加了一个入站规则,以允许端口 9000 上的入站连接.仍然没有任何改变.我该如何解决这个问题?

Then, I added an inbound rule for my firewall to allow inbound connections on port 9000. Still, nothing changed. How can I fix this?

推荐答案

对我来说修复它的是将这一行添加到用户设置中:

What fixed it for me, was adding this line to user settings:

"phpserver.phpPath": "c:\\Ampps\\php-7.1\\php.exe"

您的路径可能会有所不同.(-> 出现错误,因为没有找到你的 php)

Your path may vary. (-> error occurs, because your php is not found)

phpserver:这是因为我使用了 PHP Server 扩展.如果您使用不同的扩展程序,则需要不同的参数.

phpserver: This is because I use the PHP Server extension. If you use a different extension, you need a different parameter.

这篇关于Microsoft VS Code:当我尝试启动我的程序时出现错误“spawn php ENOENT"出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆