Stop data retention! Click here & act! Are you a webmaster and want to participate? Here you can find all necessary material for your website - Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Chris Karakas Online Forum Index Karakas Online
 FAQFAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
How to upgrade PHP PEAR from 1.2.1 to 1.6.2



 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP Forum RSS Feed of this Forum
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea  View previous topic :: View next topic  
Author Message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Sat Jan 19, 2008 12:20 am    Post subject: How to upgrade PHP PEAR from 1.2.1 to 1.6.2
Reply with quote

Question Problem: Trying to install some PEAR package X after a long time

Code:

pear install X


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


Idea 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


Arrow 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.

Idea 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/

Exclamation 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 Rolling Eyes 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! Sad

There was no way around it: I had to dig even deeper!

Idea 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


Exclamation 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!

Idea 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! Very Happy


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

Code:

pear upgrade PEAR


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

Code:

pear upgrade-all


(takes a while...don't get impatient...)

I was able to finally upgrade my packages too. Phew...time for a beer!

Cheers! Very Happy
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Gergő Gyula
Private
Private


Joined: 19 Mar 2011
Posts: 1

PostPosted: Sat Mar 19, 2011 12:40 am    Post subject: maybe an easier way (?)
Reply with quote

Hi Chris!

Thank you very much for your solution. I've also tried to figure out an easy way to upgrade all packages, and here it is what I found:

http://pear.php.net/manual/en/installation.getting.php

The key is the new go-pear.phar file that you have to download, this should take care of all the newest packages. Then, you will have to enter into the command line:

> php go-pear.phar

and this will do a re-installation of the Pear, to the newest version, with the packages compatible with each other. Hope this will work for anybody!

Cheers,
Gergő
Back to top
View user's profile Send private message
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea 
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP Forum
Page 1 of 1
This page contains valid HTML 4.01 Transitional - click here to check it!
This page contains a valid CSS - click here to check it!

 

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group