2011-12-12 52 views
3

我使用MAMP 2.0.5,我有一個問題,升級PEARMAMP PEAR配置是指向本地目錄

的問題是,PEAR總是安裝在「本地「PEAR目錄而不是MAMP PEAR目錄。

我MAMP PEAR配置如下:

sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-show 

Configuration (channel pear.php.net): 
===================================== 
Auto-discover new Channels  auto_discover 1 
Default Channel    default_channel pear.php.net 
HTTP Proxy Server Address  http_proxy  <not set> 
PEAR server [DEPRECATED]  master_server pear.php.net 
Default Channel Mirror   preferred_mirror pear.php.net 
Remote Configuration File  remote_config <not set> 
PEAR executables directory  bin_dir   /usr/local/bin 
PEAR documentation directory doc_dir   /usr/local/docs 
PHP extension directory  ext_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20060613 
PEAR directory     php_dir   /usr/local/share/pear 
PEAR Installer cache directory cache_dir  /tmp/pear/cache 
PEAR configuration file  cfg_dir   /usr/local/cfg 
directory 
PEAR data directory   data_dir   /usr/local/data 
PEAR Installer download  download_dir  /tmp/pear/install 
directory 
PHP CLI/CGI binary    php_bin   /Applications/MAMP/bin/php/php5.3.6/bin/php 
php.ini location    php_ini   <not set> 
--program-prefix passed to  php_prefix  <not set> 
PHP's ./configure 
--program-suffix passed to  php_suffix  <not set> 
PHP's ./configure 
PEAR Installer temp directory temp_dir   /tmp/pear/install 
PEAR test directory   test_dir   /usr/local/tests 
PEAR www files directory  www_dir   /usr/local/www 
Cache TimeToLive    cache_ttl  3600 
Preferred Package State  preferred_state stable 
Unix file mask     umask   22 
Debug Log Level    verbose   1 
PEAR password (for    password   <not set> 
maintainers) 
Signature Handling Program  sig_bin   /usr/local/bin/gpg 
Signature Key Directory  sig_keydir  /Applications/MAMP/conf/php/php5.3.6/pearkeys 
Signature Key Id    sig_keyid  <not set> 
Package Signature Type   sig_type   gpg 
PEAR username (for    username   <not set> 
maintainers) 
User Configuration File  Filename   /Users/udos/.pearrc 
System Configuration File  Filename   /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf 

我的問題(S):

  • 它是正確的,甲基苯丙胺是使用 「本地」 目錄來安裝PEAR?
  • 有人能指出一個「正確的」MAMP梨配置應該是什麼樣子?

一些建議如何解決?

更新(1):

首先我切換到MAMP bin目錄

cd /Applications/MAMP/bin/php/php5.3.6/bin/ 

檢查目錄

ls -al 
total 56080 
drwxr-xr-x 10 udos admin  340 Dec 26 11:40 . 
drwxr-xr-x 7 udos admin  238 Dec 10 14:09 .. 
-rwxr-xr-x 1 udos admin  924 Dec 26 11:40 pear 
-rwxr-xr-x 1 udos admin  945 Dec 26 11:40 peardev 
-rwxr-xr-x 1 udos admin  861 Dec 26 11:40 pecl 
-rwxr-xr-x 1 udos admin  14821 Dec 26 11:40 phar 
-rwxr-xr-x 1 udos admin  14821 Dec 26 11:40 phar.phar 
-rwxr-xr-x 1 udos admin 28652364 Dec 26 11:40 php 
-rwxr-xr-x 1 udos admin  3892 Dec 26 11:40 php-config 
-rwxr-xr-x 1 udos admin  4582 Dec 26 11:40 phpize 

的內容將根據威廉姆斯answer更改後我配置看起來像這樣

./pear config-show 

Configuration (channel pear.php.net): 
===================================== 
Auto-discover new Channels  auto_discover 1 
Default Channel    default_channel pear.php.net 
HTTP Proxy Server Address  http_proxy  <not set> 
PEAR server [DEPRECATED]  master_server pear.php.net 
Default Channel Mirror   preferred_mirror pear.php.net 
Remote Configuration File  remote_config <not set> 
PEAR executables directory  bin_dir   /usr/local/bin 
PEAR documentation directory doc_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/doc/ 
PHP extension directory  ext_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20060613 
PEAR directory     php_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/ 
PEAR Installer cache directory cache_dir  /tmp/pear/cache 
PEAR configuration file  cfg_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/cfg 
directory 
PEAR data directory   data_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/data/ 
PEAR Installer download  download_dir  /tmp/pear/install 
directory 
PHP CLI/CGI binary    php_bin   /Applications/MAMP/bin/php/php5.3.6/bin/php 
php.ini location    php_ini   <not set> 
--program-prefix passed to  php_prefix  <not set> 
PHP's ./configure 
--program-suffix passed to  php_suffix  <not set> 
PHP's ./configure 
PEAR Installer temp directory temp_dir   /tmp/pear/install 
PEAR test directory   test_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/test/ 
PEAR www files directory  www_dir   /Applications/MAMP/bin/php/php5.3.6/lib/php/www 
Cache TimeToLive    cache_ttl  3600 
Preferred Package State  preferred_state stable 
Unix file mask     umask   22 
Debug Log Level    verbose   1 
PEAR password (for    password   <not set> 
maintainers) 
Signature Handling Program  sig_bin   /usr/local/bin/gpg 
Signature Key Directory  sig_keydir  /Applications/MAMP/conf/php/php5.3.6/pearkeys 
Signature Key Id    sig_keyid  <not set> 
Package Signature Type   sig_type   gpg 
PEAR username (for    username   <not set> 
maintainers) 
User Configuration File  Filename   /Users/udos/.pearrc 
System Configuration File  Filename   /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf 

運行

./pear upgrade --force 

更新PEAR顯示如下:

downloading Archive_Tar-1.3.8.tgz ... 
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes) 
......done: 17,995 bytes 
downloading Console_Getopt-1.3.1.tgz ... 
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes) 
...done: 4,471 bytes 
downloading PEAR-1.9.4.tgz ... 
Starting to download PEAR-1.9.4.tgz (296,332 bytes) 
...done: 296,332 bytes 
downloading Structures_Graph-1.0.4.tgz ... 
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes) 
...done: 30,318 bytes 
downloading XML_Util-1.2.1.tgz ... 
Starting to download XML_Util-1.2.1.tgz (17,729 bytes) 
...done: 17,729 bytes 
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.8 
upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1 
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.4 
upgrade ok: channel://pear.php.net/XML_Util-1.2.1 
upgrade ok: channel://pear.php.net/PEAR-1.9.4 
PEAR: Optional feature webinstaller available (PEAR's web-based installer) 
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) 
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) 
PEAR: To install optional features use "pear install pear/PEAR#featurename" 

檢查PEAR版本生成以下錯誤

AirTime:bin udos$ ./pear version 
-bash: ./pear: No such file or directory 

這個看上去很奇怪,所以我檢查的內容bin dir

AirTime:bin udos$ ls -al 
total 56056 
drwxr-xr-x 7 udos admin  238 Dec 26 11:48 . 
drwxr-xr-x 7 udos admin  238 Dec 10 14:09 .. 
-rwxr-xr-x 1 udos admin  14821 Dec 26 11:40 phar 
-rwxr-xr-x 1 udos admin  14821 Dec 26 11:40 phar.phar 
-rwxr-xr-x 1 udos admin 28652364 Dec 26 11:40 php 
-rwxr-xr-x 1 udos admin  3892 Dec 26 11:40 php-config 
-rwxr-xr-x 1 udos admin  4582 Dec 26 11:40 phpize 

一些文件丟失:

  • peardev
  • PECL

檢查

AirTime:bin udos$ which pear 
/usr/local/bin/pear 

表明,PEAR是(再次)本地安裝..

一些想法如何解決?

更新(2):

我不得不在本地安裝PEAR。這解決了這個問題。

回答

5

我做了一點挖,這似乎解決了PHP版本問題:

sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set php_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/ 
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set doc_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/doc/ 
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set data_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/data/ 
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set test_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/test/ 
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set www_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/www 
sudo mkdir /Applications/MAMP/bin/php/php5.3.6/lib/php/www 
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-show 
sudo /Applications/MAMP/bin/php/php5.3.6/bin/pear config-set cfg_dir /Applications/MAMP/bin/php/php5.3.6/lib/php/cfg 
sudo mkdir /Applications/MAMP/bin/php/php5.3.6/lib/php/cfg 

然後就cd到/Applications/MAMP/bin/php/php5.3.6/bin和運行./pear upgrade --force

這將設置在.pearrc所有配置文件沒有考慮將它們集成到MAMP中的pear.conf中。

> cd /Applications/MAMP/bin/php/php5.3.6/bin 
> ./pear version 
PEAR Version: 1.9.4 
PHP Version: 5.3.6 
Zend Engine Version: 2.3.0 
Running on: Darwin willem.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64 
+0

感謝挖掘到這一點。不幸的是它並沒有在我的身邊工作......如果你能看看我的問題的更新(2),我將不勝感激。 – udo

+0

安裝本地PEAR版本(不僅是MAMP版本)後,問題得到解決。你指出了正確的方向。謝謝。 – udo

1

您可以使用PEAR捆綁器:

http://github.com/c9s/Onion

你可以運行:

$ onion.phar -d bundle 

安裝PEAR包到本地目錄。 (沒有root權限)

+0

感謝您指出這個選擇。目前我想弄清楚這個問題的原因(理解)... – udo

2

如果有人有這個問題,有確切的問題後,我的解決辦法是:

cd /usr

,並創建在該目錄中

$ wget http://pear.php.net/go-pear.phar 
$ <MAMP PHP PATH> -d detect_unicode=0 go-pear.phar 
1

本地安裝對於MAMP 2.0.5與PEAR 1.9.2

我有同樣的問題,並認爲我遇到了更容易或至少更明顯的解決方案後我挖掘和挫折。

使用PEAR的config-set命令來改變,像這樣的安裝目錄:

梨配置設置bin_dir /Applications/MAMP/bin/php/php5.3.6/bin

梨配置設置docs_dir /Applications/MAMP/bin/php/php5.3.6/lib

然後繼續沿線重新分配從本地目錄到MAMP安裝的路徑。

現在:

梨升級--force PEAR

這應該給你MAMP PEAR的升級到1.9.4。

我花了一個更加複雜的路線試圖讓PHPUnit與MAMP一起工作,其中涉及手動移植安裝,然後重新分配配置路徑,但我認爲這個解決方案應該足夠了。