Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install PEAR on Windows 7, Structures/Graph error

I just did a clean install of Windows 7. I've installed Apache, Mysql and PHP 5.3.5 all separated (not using XAMPP/others).

I'm getting the following error in the install: ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar

The full stack trace is:

C:\Web\php-5.3.5>go-pear.bat

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : system

Below is a suggested file layout for your new PEAR installation.  To change individual locations, type the number in front of the directory.  Type 'all' to change all of them or simply press Enter to accept these locations.

 1. Installation base ($prefix)                   : C:\Web\php-5.3.5
 2. Temporary directory for processing            : C:\Web\php-5.3.5\tmp
 3. Temporary directory for downloads             : C:\Web\php-5.3.5\tmp
 4. Binaries directory                            : C:\Web\php-5.3.5
 5. PHP code directory ($php_dir)                 : C:\Web\php-5.3.5\pear
 6. Documentation directory                       : C:\Web\php-5.3.5\docs
 7. Data directory                                : C:\Web\php-5.3.5\data
 8. User-modifiable configuration files directory : C:\Web\php-5.3.5\cfg
 9. Public Web Files directory                    : C:\Web\php-5.3.5\www
10. Tests directory                               : C:\Web\php-5.3.5\tests
11. Name of configuration file                    : C:\Web\php-5.3.5\pear.ini
12. Path to CLI php.exe                           : C:\Web\php-5.3.5

1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to C:\Web\php-5.3.5\pear.ini...
Initialized registry...
Preparing to install...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.2.3.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.8.0.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar...
installing phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.3
install ok: channel://pear.php.net/Console_Getopt-1.2.3
ERROR: unable to unpack phar://C:/Web/php-5.3.5/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.2.tar
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.8.0
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)

PEAR: To install optional features use "pear install pear/PEAR#featurename"

** WARNING! Old version found at C:\Web\php-5.3.5, please remove it or be sure t
o use the new c:\web\php-5.3.5\pear.bat command

The 'pear' command is now at your service at c:\web\php-5.3.5\pear.bat

* WINDOWS ENVIRONMENT VARIABLES *
For convenience, a REG file is available under C:\Web\php-5.3.5\PEAR_ENV.reg .
This file creates ENV variables for the current user.

Double-click this file to add it to the current user registry.

C:\Web\php-5.3.5>
like image 896
Marcos Roriz Junior Avatar asked Jan 17 '11 20:01

Marcos Roriz Junior


2 Answers

After days of googling I've found an answer. Here is it. How to solve:

With admin permission (start cmd with admin privileges):

  1. Run the go-pear.bat that comes with the default PHP installation. It'll installs PEAR, but it's going to generate an error when installing Structures_Graph. IMO Pear needs this package to generate the package dependency (graph), since it's missing it not allow us to install or upgrade any other package.

  2. Download and uncompress Structures_Graph from the pear.php.net website (direct link). Then copy the Structure folder into the PEAR folder. The archive has three folders: docs, Structures, tests. We only need the Structures one. Copy the Structures folder to your PHP_ROOT_DIRECTORY\PEAR directory. So if you installed PHP on C:\Web\php-5.3.5 copy the Structures folder to C:\Web\php-5.3.5\PEAR\, the result should be: C:\Web\php-5.3.5\PEAR\Structures

  3. Do pear install Structures_Graph. Even though the files are present, Structures_Graph is not really installed (we had a problem during installation). So we need to run the command above.

  4. Do pear upgrade PEAR. This upgrades PEAR itself to the current version.

  5. Do pear upgrade Console_Getopt. This upgrades Console_Getopt to the current version and now we can manage and install any pear package.

like image 160
Marcos Roriz Junior Avatar answered Oct 23 '22 11:10

Marcos Roriz Junior


Marcos Roriz solution does indeed work, but to clarify point 2:

The uncompressed "Structures" folder (inside the tgz) needs to be placed inside the folder: "PEAR\pear" -> e.g. C:\wamp\bin\php\php5.3.5\PEAR\pear

like image 5
Michael Noyb Avatar answered Oct 23 '22 11:10

Michael Noyb