Monday 1 July 2013

Installing PHP Pear on Mac OSX 10.6 with PHP 5.3.3


Simplegeo is getting really hot these days and we have a couple of projects where we’re using it. It was Friday night and seemed like a good time to go and test some of the scripts that we had been building all week long, so I was just about to get started when I realized that Pear wasn’t installed on my Mac.
I did a quick look around and found a pretty useful link on ClickOnTyler. Though, I just got a strange error when I tried it out.
Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ sudo php -q go-pear.php
Password:
PHP Deprecated: Assigning the return value of new by reference is deprecated in /Users/sudhanshuraheja/go-pear.php on line 733
Deprecated: Assigning the return value of new by reference is deprecated in /Users/sudhanshuraheja/go-pear.php on line 733
Sorry! Your PHP version is too new (5.3.3) for this go-pear.
Instead use http://pear.php.net/go-pear.phar for a more stable and current
version of go-pear, more suited to your PHP version.
Thank you for your coopertion and sorry for the inconvenience!

This is how I eventually got it to work

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ curl http://pear.php.net/go-pear.phar > go-pear.phar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3591k 100 3591k 0 0 20771 0 0:02:57 0:02:57 --:--:-- 22439

Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ sudo php -d detect_unicode=0 go-pear.phar
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : /Users/sudhanshuraheja/pear
2. Temporary directory for processing : /tmp/pear/install
3. Temporary directory for downloads : /tmp/pear/install
4. Binaries directory : /Users/sudhanshuraheja/pear/bin
5. PHP code directory ($php_dir) : /Users/sudhanshuraheja/pear/share/pear
6. Documentation directory : /Users/sudhanshuraheja/pear/docs
7. Data directory : /Users/sudhanshuraheja/pear/data
8. User-modifiable configuration files directory : /Users/sudhanshuraheja/pear/cfg
9. Public Web Files directory : /Users/sudhanshuraheja/pear/www
10. Tests directory : /Users/sudhanshuraheja/pear/tests
11. Name of configuration file : /Users/sudhanshuraheja/.pearrc
1-11, 'all' or Enter to continue: 1
(Use $prefix as a shortcut for '/Users/sudhanshuraheja/pear', etc.)
Installation base ($prefix) [/Users/sudhanshuraheja/pear] : /usr/local/pear

So, it basically did everything on it’s own and in the end just asked me the following, to which I said Y
Would you like to alter php.ini ? [Y/n] : Y
Finally, a little test to see if things worked
Sudhanshus-MacBook-Pro:~ sudhanshuraheja$ /usr/local/pear/bin/pear
And yes, it worked!

No comments:

Post a Comment