MAMP PEAR配置指向本地目录

时间:2011-12-12 23:08:55

标签: macos pear mamp

我正在使用MAMP 2.0.5,我有升级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

我的问题:

  • MAMP使用“本地”目录安装PEAR是否正确?
  • 有人可以指出一个“正确”的MAMP PEAR配置应该是什么样的吗?

如何解决一些建议?

更新(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

根据willems [{3}}应用更改后,我的配置看起来像这样

./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目录的内容

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。这解决了这个问题。

4 个答案:

答案 0 :(得分: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

然后只需转到/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

答案 1 :(得分:2)

如果有人遇到此问题,在遇到确切问题后,我的解决方案就是:

cd /usr

并在该目录中创建本地安装

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

答案 2 :(得分:1)

您可以使用PEAR捆绑包:

http://github.com/c9s/Onion

你可以跑:

 $ onion.phar -d bundle 

将pear包安装到本地目录中。 (没有root权限)

答案 3 :(得分:1)

对于MAMP 2.0.5与PEAR 1.9.2

我遇到了同样的问题,并认为在经历了一些挖掘和挫折之后,我遇到了一个更容易或更明显的解决方案。

使用PEAR的config-set命令更改安装目录,如下所示:

pear config-set bin_dir /Applications/MAMP/bin/php/php5.3.6/bin

pear config-set docs_dir /Applications/MAMP/bin/php/php5.3.6/lib

然后继续沿着线路重新分配从本地目录到MAMP安装的路径。

现在:

梨升级 - 强制梨

这应该会让你的MAMP PEAR升级到1.9.4。

我采用了一个更复杂的路线试图让PHPUnit与MAMP一起工作,包括手动移植安装并稍后重新分配配置路径,但我认为这个解决方案应该足够了。