PEAR Update Issues On Snow Leopard

So I just came across some weirdness on my default install of PHP on Snow Leopard. I wanted to install the latest version of PHPUnit in order to carry out some testing, but it was asking me to update PEAR.

So I ran the usual PEAR update command;
[code language="shell"]
$ sudo pear upgrade pear
[/code]

This appeared to run without any issues. But subsequently whenever I attempted to run PEAR I was greeted with the following error message;
[code language="shell"]
/usr/local/bin/pear: fork: Resource temporarily unavailable
[/code]

I took a look inside the offending file as it is just a simple command to run the PEAR script. It looked like this;
[code language="shell"]
pear /usr/lib/php/pearcmd.php
[/code]

Obviously the script was infinitely attempting to spawn itself causing the resource temporarily unavailable error. So the simple fix was to change the script to the following;
[code language="shell"]
php /usr/lib/php/pearcmd.php $@
[/code]

I'm not quite sure why the script changed when I upgraded but it appeared to. I figured I should pop this note up in case anyone else gets caught out, or indeed I forget and get caught out again. Any insight on why this might have happened would be appreciated.

Written on October 9, 2009