chris Dark Lord of the Sith

Joined: 10 May 2003 Posts: 6262 Location: Outer Space
|
Posted: Sat Jan 19, 2008 12:20 am Post subject: How to upgrade PHP PEAR from 1.2.1 to 1.6.2 |
|
|
|
Problem: Trying to install some PEAR package X after a long time
you get tons of
| Code: |
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _element_end_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _element_end_2_0() in Common.php on line 777
|
and at the end:
| Code: |
Notice: Undefined index: package in Common.php on line 1140
The following errors where found (use force option to install anyway):
missing package name
missing summary
missing description
missing license
missing version
missing release state
missing release date
missing release notes
no maintainer(s)
no files
|
Reason: Obviously, your PEAR does not understand the package format, therefore it must be too old.
How old?
Let's see how old it was in my case:
| Code: |
pear -V
PEAR Version: 1.2.1
PHP Version: 4.3.3
Zend Engine Version: 1.3.0
|
Solution: There was a long and stony way till I reached a solution...Here's the full story with all the painful details:
Trying to upgrade pear failed:
| Code: |
pear upgrade pear
downloading PEAR-1.7.0RC2.tgz ...
...done: 298,557 bytes
requires package `PEAR' >= 1.3.3
requires package `Archive_Tar' >= 1.3.1
requires package `Console_Getopt' >= 1.2
requires package `Structures_Graph' >= 1.0.2
PEAR: Dependencies failed
|
Following the advice in the PEAR website (see the News of Jan 3rd, 2008), I tried:
| Code: |
pear upgrade --force http://pear.php.net/get/Archive_Tar http://pear.php.net/get/XML_Parser http://pear.php.net/get/Console_Getopt
|
but got:
| Code: |
downloading Archive_Tar-1.3.2.tgz ...
...done: 17,150 bytes
upgrade ok: Archive_Tar 1.3.2
downloading XML_Parser-1.2.8.tgz ...
...done: 13,476 bytes
upgrade ok: XML_Parser 1.2.8
downloading Console_Getopt-1.2.3.tgz ...
...done: 4,011 bytes
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _element_start_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _element_end_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
Warning: xml_parse(): Unable to call handler _pkginfo_cdata_2_0() in Common.php on line 777
...
Notice: Undefined index: package in Common.php on line 1140
warning : the following errors were found:
missing package name
missing summary
missing description
missing license
missing version
missing release state
missing release date
missing release notes
no maintainer(s)
no files
Notice: Undefined index: package in Installer.php on line 599
not installed
|
From the above messages, we see that Archive_Tar and XML_Parser were upgraded ok, but Console_Getopt failed, probably because it needs an updated PEAR.
So I tried:
| Code: |
pear upgrade --force PEAR-1.3.6
|
but this did not work:
| Code: |
Could not open the package file: PEAR-1.3.6
|
I guessed this had to do with the change from XML-RPC to REST in the PEAR website. So I thought that maybe I had to try:
| Code: |
pear upgrade --force http://pear.php.net/get/PEAR-1.3.6
|
Well, no...no way:
| Code: |
downloading PEAR-1.3.6.tgz ...
...done: 106,880 bytes
requires package `Console_Getopt' >= 1.2
requires package `XML_RPC' >= 1.4.0
PEAR: Dependencies failed
|
Thus PEAR required Console_Getopt >= 1.2, and XML_RPC >= 1.4.0, but Console_Getopt required a newer PEAR...
I tried to fullfill at least the dependency on XML_RPC:
| Code: |
pear upgrade --force http://pear.php.net/get/XML_RPC
downloading XML_RPC-1.5.1.tgz ...
...done: 32,215 bytes
upgrade ok: XML_RPC 1.5.1
|
and this worked, so at least XML_RPC was now up-to-date.
As in the case of Upgrading PEAR on Red Hat Enterprise ES 3, my problem seemed to be the Console_Getopt package. I had an old version of it:
| Code: |
pear list | grep Getopt
Console_Getopt 1.0 stable
|
I thus tried to install Console_Getopt manually:
I downloaded version 1.2.3 from
http://download.pear.php.net/package/Console_Getopt-1.2.3.tgz
and extracted it somewhere. It contained two files:
- package.xml
- Console_Getopt-1.2.3/Console/Getopt.php
I deleted package.xml and moved Getopt.php to
/usr/share/php/Console/
I backed up my old /usr/share/php/Console/Getopt.php first!
I changed the owner and group of the new Getopt.php from 100.cruise to root.root:
| Code: |
chown root.root Getopt.php
|
and retried upgrading PEAR:
| Code: |
pear upgrade --force http://pear.php.net/get/PEAR-1.3.6
downloading PEAR-1.3.6.tgz ...
...done: 106,880 bytes
requires package `Console_Getopt' >= 1.2
PEAR: Dependencies failed
|
Now this was bitter: I had upgraded Getopt to 1.2.3, I had told pear to "force" the upgrade and nonetheless I was getting
| Code: |
requires package `Console_Getopt' >= 1.2
|
again!
There was no way around it: I had to dig even deeper!
I decided to change the version of the Console_Getopt package manually. This could only be consistent with my action of manually upgrading Console_Getopt above.
But where do I start? How to change the version of an installed PEAR package manually?
It turned out that all I had to do is change to the
/usr/share/php/.registry
directory (notice the dot - this is a hidden directory under /usr/share/php!) and open the registry file
console_getopt.reg
which, to my luck, is just a plain text file. Somewhere in the long strings there I found this piece of text:
| Code: |
s:7:"version";s:3:"1.0";
|
I changed the "1.0" to "1.2.3" and hoped for the best...
oops...this time I got:
| Code: |
pear upgrade --force http://pear.php.net/get/PEAR-1.3.6
downloading PEAR-1.3.6.tgz ...
...done: 106,880 bytes
Notice: unserialize(): Error at offset 692 of 1395 bytes in Registry.php on line 339
requires package `Console_Getopt' >= 1.2
PEAR: Dependencies failed
|
Notice the
| Code: |
Notice: unserialize(): Error at offset 692 of 1395 bytes in Registry.php on line 339
|
line. It was in fact telling me that I had just shot up the PEAR registry!
I had one chance more: change the version string in the registry file (/usr/share/php/.registry/console_getopt.reg) from "1.2.3" to "1.2":
| Code: |
s:7:"version";s:3:"1.2";
|
AND THAT WORKED!
| Code: |
pear upgrade --force http://pear.php.net/get/PEAR-1.3.6
downloading PEAR-1.3.6.tgz ...
...done: 106,880 bytes
upgrade ok: PEAR 1.3.6
|
Now, having upgraded PEAR to the intermediate version 1.3.6, and with all other required packages in place (XML_Parser, XML_RPC, Archive_Tar and above all: Console_Getopt!), I was ready for the big leap to version 1.4.3:
| Code: |
pear upgrade --force http://pear.php.net/get/PEAR-1.4.3.tar
downloading PEAR-1.4.3.tar ...
Starting to download PEAR-1.4.3.tar (1,745,408 bytes)
.................................done: 1,745,408 bytes
upgrade ok: PEAR 1.4.3
|
BINGO!
A final
brought my PEAR installation up-to-date:
| Code: |
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update
downloading PEAR-1.6.2.tgz ...
Starting to download PEAR-1.6.2.tgz (297,794 bytes)
......done: 297,794 bytes
downloading Structures_Graph-1.0.2.tgz ...
Starting to download Structures_Graph-1.0.2.tgz (30,947 bytes)
...done: 30,947 bytes
downloading Console_Getopt-1.2.3.tgz ...
Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes)
...done: 4,011 bytes
upgrade ok: channel://pear.php.net/Console_Getopt-1.2.3
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.2
upgrade ok: channel://pear.php.net/PEAR-1.6.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
To install use "pear install PEAR#featurename"
|
With
(takes a while...don't get impatient...)
I was able to finally upgrade my packages too. Phew...time for a beer!
Cheers!  _________________ Regards
Chris Karakas
www.karakas-online.de |
|