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

删除回忆录丶 提交于 2019-11-28 17:57:16

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.

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

Steve

This is a combination of the things you need to do and a couple of new tweaks. Worked on WinXP Pro with WAMP (Wampserver 2.2.1)

Change your go-pear.bat file:

@ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d output_buffering=0 -d phar.require_hash=0 PEAR\go-pear.phar
pause

Run it - go-pear.bat

Now you've go a Pear install with a missing graph.php

Download and uncompress Structures_Graph from the pear.php.net website. Copy the Structure folder into the PEAR folder so that the key files are located as such:

PEAR\Structures\Graph.php
PEAR\Structures\Graph\Node.php

Change this line in Node.php:

require_once '/Structures/Graph.php';

Execute in the PEAR directory:

pear upgrade=all

That did it for me.

First of all, run as administrator.

Then - try to write something in target directory in the console to isolate any remaining permissions problems.

I've been having many issues after upgrading my wampserver which now comes with php 5.3.5.

I have solved the problem by installing php 5.3.0 alongside and using it to run the installer found at http://pear.php.net/go-pear. I set the php cli setting to the php5.3.5 folder without any issues.

This might be wampserver specific. To gauge if you are experiencing a similar problem here are some of the issues I encountered:

Using the go-pear.bat packaged with php5.3.5 i had the same unable to unpack error as the original poster.

Using the go-pear.bat packaged with php5.3.0 i was able to complete the installation but the pear installer was v1.8.0

Using the installer on the pear site mentioned previously with php5.3.5 i had an error "Warning: rmdir(D:\temp): Directory not empty in D:\go-pear.php on line 1237". Looking at the stack trace the Archive_Tar class was throwing an error and the installer was failing to clean up after itself.

the web frontend not write correct paths to pear.ini ig phph setting is magic_quotes_gpc = On
its doubles all slashes "\" in paths to "\" is it a bug ? Than the packages for example can be unpacked (wrong paths ?)

"unable to unpack" Message when installing packages

http://pear.php.net/bugs/bug.php?id=18212

I tried all of the above with no luck. After downloading and extracting the "Structures" folder I had to edit all paths and add "PEAR/". Then I was able to do "pear install Structures_Graph" and then "pear upgrade-all"

Graph.php

require_once 'PEAR/Structures/Graph/Node.php';

Node.php

require_once 'PEAR/Structures/Graph.php';

AcyclicTest.php

require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';

TopologicalSorter.php

require_once 'PEAR/Structures/Graph.php';
require_once 'PEAR/Structures/Graph/Node.php';
require_once 'PEAR/Structures/Graph/Manipulator/AcyclicTest.php';
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!