Offline installation of PEAR packages

A few days ago I was trying to set up an offline installation of the FirePHPCore PEAR package on a computer that isn’t connected to the internet. This task wasn’t as easy as I thought it would be.

I downloaded the package (on a computer that has an internet connection) using:

  1. pear channel-discover pear.firephp.org
  2. pear download firephp/FirePHPCore

This gave me a file called FirePHPCore-0.3.1.tgz. Quite pleased with myself I transferred this file to the target machine and ran:

pear install -O FirePHPCore-0.3.1.tgz

This gave me the following error:

Parsing of package.xml from file “/tmp/pear/cache/package.xml” failed
Cannot download non-local package “FirePHPCore-0.3.1.tgz”
Package “FirePHPCore-0.3.1.tgz” is not valid
install failed

That can’t be good. I tried to fix this problem in several ways. I ended up with the following solution:

  1. Extract the contents of the tar file using: tar xzf FirePHPCore-0.3.1.tgz. This creates a file called package.xml and a directory called FirePHPCore-0.3.1 with some files in it.
  2. Edit the package.xml file and change the contents of the “channel” tag (line 4) from pear.firephp.org to pear.php.net
  3. Recreate the tgz file using: tar czf FirePHPCore-0.3.1.tgz package.xml FirePHPCore-0.3.1/*
  4. You are now the proud owner of a FirePHPCore-0.3.1.tgz file that can be installed offline.

Running pear install -O FirePHPCore-0.3.1.tgz on the new tgz file now results in:

install ok: channel://pear.php.net/FirePHPCore-0.3.1

Much better.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *