2011-02-12 126 views
18

我有PHP5通過macports安裝在/opt/local/... macports的默認位置。沒有梨的portfile。如果我從梨網站執行標準梨安裝,應該將哪些目錄位置放入梨中以與PHP一起工作?macports的梨安裝PHP5

回答

26

雖然curl選項有效,但在更新端口時它不會更新。一種替代方案:

sudo port install php5 +pear 

這將安裝PHP5的變種梨,在相同的位置上面下載,併爲您更新的MacPorts它會更新。

+0

不要忘了使用pear config-set來將您的配置變量更改爲macports/opt/local目錄! – CamelBlues 2011-07-20 19:45:35

8

我剛纔有一個類似的問題,並且正好在您提到的目錄中安裝PEAR。

curl -O http://pear.php.net/go-pear.phar 
sudo php go-pear.phar 

我將安裝基目錄($ prefix)更改爲指向/ opt/local並運行安裝程序。它修改了我的php.ini文件以包含PEAR路徑。

我的bash路徑已經包含/ opt/local/bin,所以PEAR剛剛工作!

+0

涼爽。真高興你做到了! – demet8 2011-05-05 15:21:23

0

對於那些在MacPorts之外運行PHP @ Ben的回答,進行以下修改,實際上是解決問題的方法。我需要PEAR來安裝PHPUnit,所以我可以做一些單元測試,但是我使用XAMPP。

我跟着本的解決方案,但試圖安裝它時出現錯誤。我的錯誤是:

WARNING! The include_path defined in the currently used php.ini does 
not contain the PEAR PHP directory you just specified: 
</opt/local/share/pear> 
If the specified directory is also not in the include_path used by 
your scripts, you will have problems getting any PEAR packages working. 

Current include path   : .: 
Configured directory   : /opt/local/share/pear 
Currently used php.ini (guess) : 

我設置目前使用的php.ini文件的路徑以下和所有的工作完美:

/Applications/XAMPP/xamppfiles/etc/php.ini

希望,在最壞的情況,這有助於其他XAMPP用戶!

2

我不知道爲什麼沒有人寫了一個更新的解決方案,所以我這樣做:

sudo port install pear-PEAR 
sudo port install php53-pear 

替換53與要使用任何PHP的版本。然後用MacPorts安裝您需要的pear-package!你可以得到可用的軟件包的完整列表,與

port echo name:^pear- 

如在其他答案的評論中提到,去這裏更多的信息: https://superuser.com/q/650299/39309