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/