Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.15

Bug #5906 Upgrading PEAR package removes pear command
Submitted: 2005-11-09 16:07 UTC
From: jklawite at sierra-bravo dot com Assigned: pajoye
Status: Bogus Package: PEAR
PHP Version: 4.3.2 OS: Red Hat Enterprise Linux 3
Roadmaps: (Not assigned)    

 [2005-11-09 16:07 UTC] jklawite at sierra-bravo dot com
Description: ------------ Trying to update to PEAR 1.4.4 this morning I ran [xxx@WNSgateway xxx]#pear upgrade PEAR downloading PEAR-1.4.4.tgz ... ...done: 276,978 bytes upgrade ok: PEAR 1.4.4 [xxx@WNSgateway xxx]# pear list-all -bash: /usr/bin/pear: No such file or directory I searched the system and could not find any trace of the files included in the scripts folder of the PEAR-1.4.4 package. I then downloaded PEAR-1.4.4.tgz, unpacked it and tried to move the files in the scripts folder into their proper places. Now when I run any pear command I get this error Fatal error: Call to undefined function: getopt2() in /usr/share/pear/System.php on line 78 Expected result: ---------------- Pear to upgrade and still have the "pear" command available to use Actual result: -------------- -bash: /usr/bin/pear: No such file or directory


 [2005-11-09 16:28 UTC] cellog
from which PEAR version were you upgrading? To make your manual upgrade successful, try unpacking Console_Getopt-1.2.tgz as well, as getopt2() is defined in Console/Getopt.php in the latest version
 [2005-11-11 17:37 UTC] normelton at gmail dot com
I can confirm that I lost my pear command after attempting to upgrade to 1.4.4 on two separate boxes. Both exhibited identical behavior. See bug #5939 (dup of this) for details. Norman
 [2005-11-12 06:25 UTC] cellog
I cannot reproduce this behavior, but I do have some ideas of why this may have happened. 1) bin_dir was set to a place not in the path. To verify this, try "locate peardev" as this will find the missing peardev script file, which is also a part of 1.4.4 2) you ran as "sudo pear upgrade PEAR" and your local user's configuration file contains a different bin_dir Again, same procedure. I have run into both of these problems. Also the fact that the path for root user is different then that of the sudo user can really throw things off. Please try these steps and advise.
 [2005-12-06 12:08 UTC] richardbirch at albumsnaps dot com
I've recently experienced this behaviour too. I upgraded pear on two redhat servers to version 1.4.5 after reading about the upgrade available that fixes a vulnerability in versions below 1.4.3. I think the version I upgraded from was around 1.3 However, after the upgrade the /usr/bin/pear script disappeared. I upgraded the only way I know how by issuing the; # pear upgrade PEAR command. I tried the upgrade on a gentoo server too and it seemed to work fine so I guess it's an issue with redhat? I've tried copying the /usr/bin/pear script from my gentoo server (and changed the paths to /usr/share/pear) but I get no output when typing eg. # pear list Typing 'pear' gives me the list of options, but I can't us any of them. Any idea how to fix this? BTW I also tried typing 'locate peardev' but this produces no output at all
 [2005-12-06 14:25 UTC] pajoye
Sorry, but your problem does not imply a bug in PEAR itself. For a list of more appropriate places to ask for help using PEAR, please visit as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PEAR. After another short discussion on IRC, it seems that the problem was only a museum PEAR version (RHE3, pear 1.1). Marked as bogus as nobody is able to reproduce from 1.3.x
 [2006-01-31 18:24 UTC] nefertitian at gmail dot com
have the same problem. installed pear from the SLES 9 CD sets. then upgraded pear. and then onwards, for every command that I type, i get the missing 'getopt2' function call.
 [2006-10-25 14:47 UTC] ashnazg at users dot sourceforge dot net (Chuck Burgess)
I just had to deal with this problem, so since I found very little online to help me figure it out, I thought I'd update this thread in the hopes it helps the next person... I had this problem, getting "Call to undefined function: getopt2()" in PEAR 1.4.11 (the current stable version as of today). What I discovered was that my PATH was set such that my personal installation of PEAR was NOT the one being run by my shell... my PATH was finding a system-wide PEAR installation and running it instead. It wasn't enough for me to force my local pear command to run (">./pear help")... I had to set my PATH to have my pear's bin directory ahead of the other system paths. I believe running my personal copy ("./pear") without my local pear bin being in my PATH, the other pear-related stuff that "./pear" tried to run was attempting to use the PEAR stuff it found in the system-wide installation. Since my system-wide installation is much older than my personal one, the discrepancy between what it expected to find in Getopts.php and what was in the system-wide version of it should not be a surprise. Once I added "PATH=~/my_pear_installation_dir/bin:$PATH", everything started working.