Installing PEAR with PHP on Mac OSX 10.8.2

20
2014-03
  • dennismonsewicz

    I am following this tutorial: http://vanderveer.be/blog/2012/04/21/setting-up-my-perfect-developer-environment-on-osx-10-dot-8-mountain-lion-dp3-edition/

    But am running into the following issues when I get down to the installation of PEAR

    [PEAR] Archive_Tar: upgrade to a newer version (1.3.7 is not newer than 1.3.7)
    [PEAR] Console_Getopt: upgrade to a newer version (1.3.0 is not newer than 1.3.0)
    [PEAR] Structures_Graph: upgrade to a newer version (1.0.4 is not newer than 1.0.4)
    [PEAR] XML_Util: upgrade to a newer version (1.2.1 is not newer than 1.2.1)
    [PEAR] PEAR: upgrade to a newer version (1.9.4 is not newer than 1.9.4)
    

    Here is my $PATH: /Users/dennismonsewicz/.rvm/gems/ruby-1.9.3-p125/bin:/Users/dennismonsewicz/.rvm/gems/ruby-1.9.3-p125@global/bin:/Users/dennismonsewicz/.rvm/rubies/ruby-1.9.3-p125/bin:/Users/dennismonsewicz/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin

    Here is the path for PHP: /usr/bin/php

  • Answers
  • dennismonsewicz

    Figured it out.. It was an old .pearrc file in my ~/ directory


  • Related Question

    upgrade - How to install an updated version of PEAR / PHPUnit on Ubuntu?
  • Andrew

    Most tutorials online show how to install PEAR by doing this:

    sudo apt-get install php-pear
    

    This installs version 1.6.1. It works great because it's super easy! My problem is that I want to install PHPUnit and it requires PEAR version 1.8.1 so my install of PHPUnit failed. So how do I install a newer version of PEAR on Ubuntu?


  • Related Answers
  • Oliver Salzburg

    First, install PEAR.

    sudo apt-get install php-pear
    

    Next, tell PEAR to update its own channel.

    sudo pear channel-update pear.php.net
    

    Then, tell PEAR to upgrade itself to the newest version.

    sudo pear upgrade-all
    

    You should now have the newest version of PEAR installed.

    To install PHPUnit, let PEAR know where to find PHPUnit.

    sudo pear channel-discover pear.phpunit.de
    

    Then install PHPUnit. (the -a makes sure all dependency packages are also installed)

    sudo pear install -a phpunit/PHPUnit
    

    Update:

    According to the latest PHPUnit installation documentation, you can install PHPUnit with the following commands (make sure you have updated PEAR first):

    sudo pear config-set auto_discover 1
    sudo pear install pear.phpunit.de/PHPUnit
    
  • Ronan

    Last versions of PhpUnit require ez/zeta components & symfony's YAML lib

    sudo apt-get install php-pear
    sudo pear channel-update pear.php.net
    sudo pear upgrade-all
    sudo pear channel-discover pear.phpunit.de
    sudo pear channel-discover components.ez.no
    sudo pear channel-discover pear.symfony-project.com
    sudo pear install -a phpunit/PHPUnit
    

    See the last updated installation tutorial here

  • Pi3cH

    If installation using above command failed, You might need to install Net_URL2-0.3.1 and then HTTP_Request2-2.0.0RC1 before installation of PHPUnit on Ubuntu. Find the latest version of the above packages and install them.

    Example:

    sudo apt-get install curl

    sudo pear install pear/Net_URL2-0.3.1

    sudo pear install pear/HTTP_Request2-2.0.0RC1

    sudo pear install -a phpunit/PHPUnit