简体   繁体   English

使用vscode和mamp在mac上的php可执行文件的路径

[英]Path to php executable on a mac with vscode and mamp

vscode requires path to php set for this parameter: vscode需要为此参数设置php的路径:

"php.validate.executablePath": “php.validate.executablePath”:

so I specified this: 所以我指定了这个:

"/Applications/MAMP/bin/php/php7.0.12/bin/php" “/Applications/MAMP/bin/php/php7.0.12/bin/php”

but it isn't recognized. 但它不被承认。

What is the correct path ? 什么是正确的道路?

I am using mac i have install php intellisense that required php version 7 executable path i have already php 7 installed. 我正在使用mac我已经安装了php intellisense ,需要php版本7可执行路径我已经安装了php 7。 Terminal command 终端命令

which php

work for me. 为我工作。

I ran into this problem after installing the PHP Intellisense extension in vscode. 我在vscode中安装PHP Intellisense扩展后遇到了这个问题。 For Intellisense to work I needed to point vscode at MAMP's version of PHP, not the default OS X version of PHP, but it did not recognise the path I was specifying. 为了使Intellisense工作,我需要在MAMP的PHP版本中指向vscode,而不是默认的OS X版本的PHP,但它不能识别我指定的路径。

I was able to resolve the issue by specifying the "php.executablePath" preference instead of "php.validate.executablePath" . 我能够通过指定"php.executablePath"首选项而不是"php.validate.executablePath"来解决此问题。

"php.executablePath": "/Applications/MAMP/bin/php/php7.0.12/bin/php"

Here is an explanation from the author of the package: 以下是该软件包的作者的解释

validate has nothing to do with this extension, but is the built-in validation of VS Code. validate与此扩展无关,但是是VS Code的内置验证。 I would disable that, because you will get duplicate validation. 我会禁用它,因为你会得到重复的验证。 php.executablePath should be set to the path of the binary php.executablePath应该设置为二进制文件的路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM