Getting pyrus.phar to work on a Mac (OS 10.5+)


After needing to use the PEAR::HTTP_Request class to build an auto-login script I tried to use the PEAR install command-line syntax and ran into the usual difficulties with where was it going to install the downloaded files, were the channels up-to-date, etc.  So on the class page I noticed a new installer that was to improved the pear class installation procedure and promised to allow local installations of the downloaded classes – meaning you could install the classes required for that project in the projects subdirectories allowing you to easily move the code from dev/live/svn.

When I downloaded the pyrus.phar installer and ran it using the following commands using CLI PHP on the Mac:

php pyrus.phar ./lib/pear set bin_dir ./lib/pear
php pyrus.phar ./lib/pear install pear/HTTP_Request2

all that returned was:



It turns out that the while the PHP version that ships with Snow Leopard is compiled with the PHAR extensions and can run these files, there is a Zend directive that conflicts with it.  It is: detect_unicode

To correct this edit the php.ini file that your command-line PHP is using (mine wasn’t using any so I forced it to use the php.ini.default one in the /etc directory) by adding this line somewhere in the file:

detect_unicode = Off

Now when I run the command:

php -c /etc/php.ini.default pyrus.phar ./lib/pear set bin_dir ./lib/pear

I no longer receive gibberish but instead receive a second problem that I’ve yet to figure out:

Invalid Schema in phar://usr/local/web/Microsite/pyrus.phar/PEAR2_Pyrus-2.0.0a2/php/PEAR2/Pyrus/XMLParser.php on line 199

but, at least pyrus.phar now runs…


PHP 5.3.3+ (it’s reported that 5.3.1 may work)

Pear PHP

Tags: ,

No comments yet.

Leave a Reply