2017-03-03 82 views
1

我剛剛在Mac電腦上安裝VS CODE版本1.10.1(操作系統10.12.3),然後將php升級到版本7,並通過將phpinfo()放入腳本命名爲info.php,然後在瀏覽器中運行它以驗證PHP 7正在使用中。VS Code給PHP PHP安裝時運行PHP 5.6的錯誤

在VS代碼打開此相同info.php文件後,我得到以下錯誤:

The language server needs at least PHP 7 installed.
Version found: 5.6.28

我是否需要更改VS碼設置的東西得到它看到正在運行的正確的PHP版本我蘋果電腦?

如果我正在編輯Docker容器中的文件,這會不同嗎?

回答

0

你必須改變你的路徑變量。 打開.bash_profile文件在你的home目錄 -

nano ~/.bash_profile 

,你會看到PHP版本28年6月5日路徑。將其更改爲路徑7.x版,保存文件(Ctrl + X),重新啓動VS代碼,你應該是好去

1
  1. 確保升級的PHP版本PHP7。 檢查你的終端:PHP -v

  2. 變化vscode設置, 添加波紋線setting.json:

「php.validate.executablePath」:「在/ usr /本地/ php5- 7.1.4-20170506-100436 /斌/ PHP的」

1

當從https://php-osx.liip.ch升級到PHP7它指出:

php-osx doesn't overwrite the php binaries installed by Apple, but installs everything in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php.

我加個是我的settings.json路徑:

「php.executablePath」:「/ usr/local/php5/bin/php」