簡體   English   中英

如何在Mac OSX El Capitan中更改PHP版本?

[英]How to change PHP version in Mac OSX El Capitan?

我在Mac OS 10.11.5(El Capitan)中使用MAMP設置。 這對於Web服務器而言效果很好,但是當我嘗試使用PHP CLI時,Terminal使用系統版本:

$ which php
/usr/bin/php

從我發現和閱讀的所有內容來看,似乎解決方案是將MAMP版本添加到我的PATH

PATH="$HOME/Applications/MAMP/bin/php/php5.6.10/bin:$PATH"

但是,在添加此內容,關閉並重新打開窗口並獲取文件后,Terminal仍然找不到我想要的版本。

這個有一個要點https://gist.github.com/irazasyed/5987693

Within the Terminal, run vim ~/.bash_profile

Type i and then paste the following at the top of the file:

export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH

Hit ESC, Type :wq, and hit Enter

In Terminal, run source ~/.bash_profile

In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.

In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM