As part of getting an upgraded server set up and transferring sites from the older server, I had to re-install PEAR XML_RSS. One of its dependencies is XML_Tree.
Normally, this command should have worked with no problems:
pear install XML_RSS
It downloaded XML_RSS just fine, but then choked on XML_Tree, which was a required dependency.
Initial output:
# pear install XML_RSS
Did not download dependencies: pear/XML_Tree, use --alldeps or --onlyreqdeps to download automatically
pear/XML_RSS requires package "pear/XML_Tree"
No valid packages found
install failed
My next try was to specify installing XML_Tree:
# pear install XML_Tree
WARNING: "pear/XML_Tree" is deprecated in favor of "pear/XML_Serializer"
downloading XML_Tree-1.1.tgz ...
Starting to download XML_Tree-1.1.tgz (4,826 bytes)
.....done: 4,826 bytes
XML error: not well-formed (invalid token) at line 10
Download of "pear/XML_Tree" succeeded, but it is not a valid package archive
Error: cannot download "pear/XML_Tree"
Download failed
install failed
After some troubleshooting, here is how I fixed this problem:
- Change directory into the PEAR download cache directory:
cd /tmp/pear/cache/
- Clear out all the old cache files:
pear clear-cache
- You should see the downloaded file: XML_Tree-1.1.tgz
- Extract the files:
tar xvfz XML_Tree-1.1.tgz
- Now edit the extracted package.xml file:
vi package.xml
- Go to line 10 and change the ö to an o. This is the character that is causing the XML validation of the package file to fail. Next, save the file (
ESC :wq
) - Next, remove the old .tgz file:
rm -rf XML_Tree-1.1.tgz
- We’re going to recreate the package:
tar cfv - package.xml XML_Tree-1.1/ | gzip > XML_Tree-1.1.tgz
- Next, we’re going to install this package and not use the network:
pear install -O XML_Tree-1.1.tgz
XML_Tree is now installed. You should now be able to continue installing XML_RSS normally.
One response to “How to fix PEAR installation of XML_RSS / XML_Tree invalid package.xml file problem”
thank you very much for this entry – really _really_ sucks that pear craps itself on accented characters – BUT thanks for showing how to get around it.