7

I'm willing to install phpunit 5.3 with MAMP 1.9 and there for I need to upgrade PEAR to version 1.9.1. The current version installed is 1.9.0.

When I try the to upgrade I get the following:

sudo pear channel-update pear.php.net
sudo pear upgrade pear
Could not get contents of package "/Applications/MAMP/bin/php5.3/bin/pear". Invalid tgz file.
upgrade failed

When I force the upgrade It still doesn't work:

sudo pear upgrade --force PEAR
downloading PEAR-1.9.1.tgz ...
Starting to download PEAR-1.9.1.tgz (293,587 bytes)
.............................................................done: 293,587 bytes
upgrade ok: channel://pear.php.net/PEAR-1.9.1
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"

sudo pear -V
PEAR Version: 1.9.0

As bindbn suggested:

sudo pear install --offline /Users/tom/Downloads/PEAR-1.9.1.tgz 
Ignoring installed package pear/PEAR
Nothing to install

sudo pear upgrade --force --alldeps PEAR
downloading PEAR-1.9.1.tgz ...
Starting to download PEAR-1.9.1.tgz (293,587 bytes)
.............................................................done: 293,587 bytes
upgrade ok: channel://pear.php.net/PEAR-1.9.1
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 -V
PEAR Version: 1.9.0

I hope someone can figure this out! Thanks!

tom
  • 535
  • 2
  • 6
  • 14

4 Answers4

9

I had the same problem. You must reconfigure it to find the PEAR packages.

Replace the php version of Mac OS X by that of MAMP

$ cd /usr/bin
$ cp php php.bak (Backup the old version)
$ ln -s /Application/MAMP/bin/php5.3/bin/php (link to the version of MAMP php)
$ sudo chmod 0554 /Application/MAMP/bin/php5.3/bin/* (makes all the scripts executable)

$ php -v
PHP 5.3.2 (cli) (built: Mar  5 2010 16:45:34) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.0, Copyright (c) 2005-2009, by mOo

Configuring PEAR :

 $ cd /Application/MAMP/bin/php5.3/bin
 $ pear -V
 PEAR Version: 1.9.0
 PHP Version: 5.3.2
 Zend Engine Version: 2.3.0
 Running on: 
 Darwin mbp.local 9.8.0 
 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; 
 root:xnu-1228.15.4~1/RELEASE_I386 i386

$ pear config-show

Modify the following keys to point to the folder in /Applications/MAMP/bin/php5.3/lib/php

$ pear config-set [key] [path]

PEAR documentation directory   doc_dir          /Applications/MAMP/bin/php5.3/lib/php/doc
PHP extension directory        ext_dir          /Applications/MAMP/bin/php5.3/lib/php/extensions
PEAR directory                 php_dir          /Applications/MAMP/bin/php5.3/lib/php/PEAR
PHP CLI/CGI binary             php_bin          /Applications/MAMP/bin/php5.3/bin/php
php.ini location               php_ini          /Applications/MAMP/conf/php5.3/php.ini
Signature Key Directory        sig_keydir       /Applications/MAMP/conf/php5.3/pearkeys

Updating the channel :

$ pear channel-update pear.php.net

Upgrading PEAR :

$ pear upgrade pear
downloading PEAR-1.9.1.tgz ...
Starting to download PEAR-1.9.1.tgz (293,587 bytes)
.............................................................done: 293,587 bytes
downloading Archive_Tar-1.3.7.tgz ...
Starting to download Archive_Tar-1.3.7.tgz (17,610 bytes)
...done: 17,610 bytes
downloading Structures_Graph-1.0.3.tgz ...
Starting to download Structures_Graph-1.0.3.tgz (30,191 bytes)
...done: 30,191 bytes
downloading Console_Getopt-1.2.3.tgz ...
Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes)
...done: 4,011 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.7
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.3
upgrade ok: channel://pear.php.net/Console_Getopt-1.2.3
upgrade ok: channel://pear.php.net/XML_Util-1.2.1
upgrade ok: channel://pear.php.net/PEAR-1.9.1
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 -V
PEAR Version: 1.9.1
PHP Version: 5.3.2
Zend Engine Version: 2.3.0
Running on: 
Darwin mbp.local 9.8.0 
Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
0

Try:

sudo pear upgrade --force --alldeps PEAR

or

sudo pear install --offline /Applications/MAMP/bin/php5.3/bin/pear/PEAR-1.9.1.tgz
bindbn
  • 5,153
  • 2
  • 26
  • 23
0

After many hours of findling. My PEAR keys were pointing to php 5 instead of php 5.2 which is the php version that is in my path.

As said above, list the pear keys with

$ pear config-show

And then set the keys

pear config-set [key] [path]

PEAR documentation directory   doc_dir          /Applications/MAMP/bin/php5.x/lib/php/doc
PHP extension directory        ext_dir          /Applications/MAMP/bin/php5.x/lib/php/extensions
PEAR directory                 php_dir          /Applications/MAMP/bin/php5.x/lib/php/PEAR
PHP CLI/CGI binary             php_bin          /Applications/MAMP/bin/php5.x/bin/php
php.ini location               php_ini          /Applications/MAMP/conf/php5.x/php.ini
Signature Key Directory        sig_keydir       /Applications/MAMP/conf/php5.x/pearkeys

Making sure that 5.x is the php version you are using. To find out what your php version is

$ php -i

Now if I can only get the php unit test to install * sigh *

0

I'm trying to install phpunit for MAMP, so here are the steps I took (after following the tutorial linked above).

$ cd /usr/bin
$ sudo rm ./php
$ sudo rm ./pear
$ sudo ln -s /Applications/MAMP/bin/php5.3/bin/pear
$ sudo ln -s /Applications/MAMP/bin/php5.3/bin/php

In your web browser, open: http://pear.php.net/go-pear

save code to /Applications/MAMP/bin/php5.3/go-pear.php

$ cd /Applications/MAMP/bin/php5.3
$ php ./go-pear.php

Follow the onscreen prompts, selecting Y when a list of packages to install comes up. You may be shown this message:

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

Would you like to alter php.ini ? [Y/n] :

Type Y to continue. It should now show:

php.ini include_path updated.

Current include path : .:/Applications/MAMP/bin/php5.3/lib/php

Configured directory : /Applications/MAMP/bin/php5.3/PEAR

Currently used php.ini (guess) : /Applications/MAMP/conf/php5.3/php.ini

Press Enter to continue:

Press enter and you should be on your way.

Now to make sure you have pear 1.9.1, run

$ pear version

Now you can follow the instructions to install phpunit. When phpunit is installed, it will be placed in /Applications/MAMP/bin/php5.3/PEAR/PHP/

Francis
  • 113
  • 1
  • 7