phpunit on MAMP 1.9.5 broken and work around

Report any found bug here. We are grateful for any useful clues.

Moderator: severin

Post Reply
dvalentiate
Posts: 7
Joined: Thu 31. Mar 2011, 15:42

phpunit on MAMP 1.9.5 broken and work around

Post by dvalentiate » Thu 31. Mar 2011, 16:08

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

Code: Select all

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

thanks to:
http://jeffreybarke.net/2010/08/how-to- ... with-mamp/
http://www.phpunit.de/manual/current/en ... ation.html

marcelorodrigo
Posts: 3
Joined: Fri 1. Apr 2011, 17:38

Re: phpunit on MAMP 1.9.5 broken and work around

Post by marcelorodrigo » Fri 1. Apr 2011, 17:40

Not working here.
After pear upgrade pear ...

Code: Select all

heisenberg:bin user$ php5/bin/pear install phpunit/PHPUnit
php5/bin/pear: line 28: /Applications/MAMP/bin/php5.3/lib/php: is a directory
php5/bin/pear: line 28: exec: /Applications/MAMP/bin/php5.3/lib/php: cannot execute: Unknown error: 0

dvalentiate
Posts: 7
Joined: Thu 31. Mar 2011, 15:42

Re: phpunit on MAMP 1.9.5 broken and work around

Post by dvalentiate » Mon 4. Apr 2011, 12:14

marcelorodrigo wrote:Not working here.
After pear upgrade pear ...

Code: Select all

heisenberg:bin user$ php5/bin/pear install phpunit/PHPUnit
php5/bin/pear: line 28: /Applications/MAMP/bin/php5.3/lib/php: is a directory
php5/bin/pear: line 28: exec: /Applications/MAMP/bin/php5.3/lib/php: cannot execute: Unknown error: 0
Not sure why it is not working for you, did you installed on a fresh download of MAMP 1.9.5?

marcelorodrigo
Posts: 3
Joined: Fri 1. Apr 2011, 17:38

Re: phpunit on MAMP 1.9.5 broken and work around

Post by marcelorodrigo » Mon 4. Apr 2011, 13:32

Yes, to be sure I ran the MAMP uninstaller and then deletes all the folders of MAMP in /Applications
Later installed the 1.9.5 version with the errors reported in the previous post. Any suggestions?

marcelorodrigo
Posts: 3
Joined: Fri 1. Apr 2011, 17:38

Re: phpunit on MAMP 1.9.5 broken and work around

Post by marcelorodrigo » Mon 4. Apr 2011, 14:12

Just have unninstalled MAMP/MAMP Pro and tried again: same error :?

dvalentiate
Posts: 7
Joined: Thu 31. Mar 2011, 15:42

Re: phpunit on MAMP 1.9.5 broken and work around

Post by dvalentiate » Mon 4. Apr 2011, 20:09

marcelorodrigo wrote:Just have unninstalled MAMP/MAMP Pro and tried again: same error :?
Not sure what is going wrong for you. I just reinstalled MAMP 1.9.5 and tried again. Worked for me.

hrward
Posts: 2
Joined: Fri 15. Apr 2011, 21:50

Re: phpunit on MAMP 1.9.5 broken and work around

Post by hrward » Fri 15. Apr 2011, 21:52

Everything above worked for me except the last command:

MacBook-Pro:bin hrw$ ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
ln: /usr/local/bin/phpunit: No such file or directory

Any suggestions?

This post has def been helpful. There are a lot of other people struggling with this. Feels like I'm really close... any help would be appreciated!!

dvalentiate
Posts: 7
Joined: Thu 31. Mar 2011, 15:42

Re: phpunit on MAMP 1.9.5 broken and work around

Post by dvalentiate » Mon 18. Apr 2011, 11:21

hrward wrote:Everything above worked for me except the last command:

MacBook-Pro:bin hrw$ ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
ln: /usr/local/bin/phpunit: No such file or directory

Any suggestions?

This post has def been helpful. There are a lot of other people struggling with this. Feels like I'm really close... any help would be appreciated!!
does the /usr/local/bin directory exist, I guess I have assumed it does.

try

Code: Select all

ls /usr/local/bin
if it doesn't exist create it using

Code: Select all

mkdir /usr/local/bin
and then rerun

Code: Select all

ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit

hrward
Posts: 2
Joined: Fri 15. Apr 2011, 21:50

Re: phpunit on MAMP 1.9.5 broken and work around

Post by hrward » Mon 18. Apr 2011, 16:23

This did the trick

Code: Select all

ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/bin/phpunit
I had a few more small issues with PHPUnit once it was running it was trying to include from /Applications/MAMP/bin/php5/bin/ whereas PEAR installed the files under /Applications/MAMP/bin/php5.3/shared/

Once i copied the needed include files into the directories that PHP was looking for everything was up and running. Thanks again.

dvalentiate
Posts: 7
Joined: Thu 31. Mar 2011, 15:42

Re: phpunit on MAMP 1.9.5 broken and work around

Post by dvalentiate » Mon 18. Apr 2011, 21:59

hrward wrote:This did the trick

Code: Select all

ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/bin/phpunit
I had a few more small issues with PHPUnit once it was running it was trying to include from /Applications/MAMP/bin/php5/bin/ whereas PEAR installed the files under /Applications/MAMP/bin/php5.3/shared/

Once i copied the needed include files into the directories that PHP was looking for everything was up and running. Thanks again.
Glad you got the to finish line.

Ah looks like you may have skipped the cd "/Applications/MAMP/bin; ln -s php5.3 php5" step.

MAMP didn't set up the pear config correctly so for me it was expecting files in a /Applications/MAMP/bin/php5 directory instead of the /Applications/MAMP/bin/php5.3 directory which pear put its files into. Easiest way around this that I found was the soft link. I might be confusing things with MAMP 1.9.4. But anyway, glad this helped.

gazbond
Posts: 2
Joined: Tue 10. May 2011, 20:20

Re: phpunit on MAMP 1.9.5 broken and work around

Post by gazbond » Tue 10. May 2011, 20:26

I'm having problems with this as well. I've followed your advice but I just don't get the phpunit file at the end. Can't I just download the files some where, I've never had much luck with package managers on OSX.

gazbond
Posts: 2
Joined: Tue 10. May 2011, 20:20

Re: phpunit on MAMP 1.9.5 broken and work around

Post by gazbond » Wed 11. May 2011, 07:55

Never mind, restarted OSX, uninstalled phpunit, reinstalled phpunit, all good now. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest