Install PEAR on MAMP

后端 未结 3 456
暗喜
暗喜 2021-01-30 04:33

I am using MAMP for development. I have never been able to get PEAR to work. The MAMP documentation and forums seem not to have the answers. Everybody who asked on the MAMP foru

3条回答
  •  孤城傲影
    2021-01-30 05:12

    If you just want phpunit to work, use the following commands on a fresh copy of MAMP 1.9.5:

    cd /Applications/MAMP/bin
    ln -s php5.3 php5
    php5/bin/pear channel-discover pear.phpunit.de
    php5/bin/pear channel-discover components.ez.no
    php5/bin/pear channel-discover pear.symfony-project.com
    php5/bin/pear channel-update pear.php.net
    php5/bin/pear upgrade pear
    php5/bin/pear install phpunit/PHPUnit
    ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
    phpunit --version
    

    Done.

    The above code fixes the following issues:

    Bug 1: pear gets confused about its version because it installs in both php5.3 and php5 directory

    Pear updates upgrades and installs from /Applications/MAMP/bin/php5.3/pear, but it will create a new /Application/MAMP/bin/php5 directory and spread files between the php5.3 direct and the new php5 directory and get very confused about what version it is.

    Fix: ln -s php5.3 php5

    I think that if you are using PHP 5.2 then using ln -s php5.2 php5 should work equally well but I haven't tested this

    Issue 2: pear is out of date

    this is understandable of the MAMP team, the problem really was that it was difficult to do a upgrade because of Bug 1

    Source: http://forum.mamp.info/viewtopic.php?f=6&t=11102

提交回复
热议问题