Installing PEAR Packages Offline

As with most tools that work really well, I know very little about PEAR. I mean, I use it all the time, and I love it for getting all the extensions installed that I need for the work I do. But I’ve never made a PEAR package, or channel, and I’ve been happy to leave all those things in the hands of the smart people who have created what we have today.

However I’m now in a situation where I might need to install PEAR packages with a connection that may or may not be working, and I’m not sure exactly which packages I might need, so I wanted to know whether I could use PEAR as my packaging tool even when I wasn’t able to reach the usual channels. And guess what? I can!

Get the Download

The first thing you’ll need is the package itself – look on the downloads page and there is a link:

You can download this file somewhere safe, put it on a USB key or equivalent if you need to get files onto a machine without connection.

Install the Package with PEAR

When you’re ready to install, just go for it – but give the filename instead of your usual package name!

 $ sudo pear install PHP_CodeSniffer-1.3.5.tgz 
install ok: channel://pear.php.net/PHP_CodeSniffer-1.3.5

There you have it – one installed package. I’m teaching PEAR installation of tools as part of my PHP tools tutorial at PHPNW in October (early bird prices still available, this one is going to be good) and I’ve been worrying about the “what if” of teaching something like this which really needs the network. So I’ll be hiding the files somewhere on the Virtual Machine I distribute to the delegates, problem solved!

For more info on that tutorial on October 5th in Manchester, you can read more about it on the PHPNW site: http://conference.phpnw.org.uk/phpnw12/tutorial-day-tools-of-the-php-trade/

One thought on “Installing PEAR Packages Offline

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.