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:
- pear channel-discover pear.firephp.org
- 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
That can’t be good. I tried to fix this problem in several ways. I ended up with the following solution:
- 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.
- Edit the package.xml file and change the contents of the “channel” tag (line 4) from pear.firephp.org to pear.php.net
- Recreate the tgz file using: tar czf FirePHPCore-0.3.1.tgz package.xml FirePHPCore-0.3.1/*
- 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