0

首先,我是 PEAR 和 Predis 的新手……我想在 Windows 7 上安装 Predis,这就是我到目前为止所做的……我已经在 C:/Redis 的计算机上安装了 Redis。PEAR 在 \wamp\bin\php\php5.3.10 中,并且安装成功。现在我尝试使用安装 Predis

pear install nrk/Predis-1.0.0

它给了我以下错误

downloading Predis-1.0.0.tar ...
Starting to download Predis-1.0.0.tar (2,014,208 bytes)
...............................done: 2,014,208 bytes

Warning: require_once(Structures/Graph.php): failed to open stream: No such file
 or directory in PEAR\Downloader.php on line 1192
PHP Warning:  require_once(Structures/Graph.php): failed to open stream: No such
 file or directory in C:\wamp\bin\php\php5.3.10\pear\PEAR\Downloader.php on line
 1192
PHP Stack trace:
PHP   1. {main}() C:\wamp\bin\php\php5.3.10\pear\pearcmd.php:0
PHP   2. PEAR_Command_Common->run() C:\wamp\bin\php\php5.3.10\pear\pearcmd.php:3
07
PHP   3. PEAR_Command_Install->doInstall() C:\wamp\bin\php\php5.3.10\pear\PEAR\C
ommand\Common.php:271
PHP   4. PEAR_Downloader->sortPackagesForInstall() C:\wamp\bin\php\php5.3.10\pea
r\PEAR\Command\Install.php:699

Warning: require_once(Structures/Graph.php): failed to open stream: No such file
 or directory in C:\wamp\bin\php\php5.3.10\pear\PEAR\Downloader.php on line 1192


Call Stack:
    0.0010     881520   1. {main}() C:\wamp\bin\php\php5.3.10\pear\pearcmd.php:0

    0.0597    4753144   2. PEAR_Command_Common->run() C:\wamp\bin\php\php5.3.10\
pear\pearcmd.php:307
    0.0597    4753144   3. PEAR_Command_Install->doInstall() C:\wamp\bin\php\php
5.3.10\pear\PEAR\Command\Common.php:271
   11.4545   13810008   4. PEAR_Downloader->sortPackagesForInstall() C:\wamp\bin
\php\php5.3.10\pear\PEAR\Command\Install.php:699

PHP Fatal error:  require_once(): Failed opening required 'Structures/Graph.php'
 (include_path='C:\wamp\bin\php\php5.3.10\pear') in C:\wamp\bin\php\php5.3.10\pe
ar\PEAR\Downloader.php on line 1192
PHP Stack trace:
PHP   1. {main}() C:\wamp\bin\php\php5.3.10\pear\pearcmd.php:0
PHP   2. PEAR_Command_Common->run() C:\wamp\bin\php\php5.3.10\pear\pearcmd.php:3
07
PHP   3. PEAR_Command_Install->doInstall() C:\wamp\bin\php\php5.3.10\pear\PEAR\C
ommand\Common.php:271
PHP   4. PEAR_Downloader->sortPackagesForInstall() C:\wamp\bin\php\php5.3.10\pea
r\PEAR\Command\Install.php:699

Fatal error: require_once(): Failed opening required 'Structures/Graph.php' (inc
lude_path='C:\wamp\bin\php\php5.3.10\pear') in C:\wamp\bin\php\php5.3.10\pear\PE
AR\Downloader.php on line 1192

Call Stack:
    0.0010     881520   1. {main}() C:\wamp\bin\php\php5.3.10\pear\pearcmd.php:0

    0.0597    4753144   2. PEAR_Command_Common->run() C:\wamp\bin\php\php5.3.10\
pear\pearcmd.php:307
    0.0597    4753144   3. PEAR_Command_Install->doInstall() C:\wamp\bin\php\php
5.3.10\pear\PEAR\Command\Common.php:271
   11.4545   13810008   4. PEAR_Downloader->sortPackagesForInstall() C:\wamp\bin
\php\php5.3.10\pear\PEAR\Command\Install.php:699
4

1 回答 1

1

好的..经过大量搜索...我在 Windows 7 上使用 Composer 安装了 Predis。以下是 Wamp 服务器。

首先,在 php.ini 中启用 php_openssl 我遵循的步骤是,

  1. 从 [这里] https://github.com/rgl/redis/downloads安装 Redis到文件夹 C:/Redis
  2. 从 [这里] https://getcomposer.org/download/在您网站的根目录中安装 Composer 。
  3. 在您网站的根目录中下载 Composer.phar.. 抱歉.. 我没有为该链接添加书签.. 所以我没有它.. :(
  4. 写这个文件composer.json

    {“要求”:{“predis/predis”:“1.1.*@dev”}}

并运行此命令

php composer.phar install

从您放置这些文件(composer.phar 和 composer.json)的文件夹中。之后,在 php.ini(apache 和 php)中写入以下 include_path :

include_path='.;C:\wamp\www\vendor\predis'

现在写这段代码来测试predis

<?php
require("predis/autoload.php");
Predis\Autoloader::register();
try {
$redis = new Predis\Client(array(
    "scheme" => "tcp",
    "host" => "127.0.0.1",
    "port" => 6379));

echo "Successfully connected to Redis";
echo $redis->ping();
}
catch (Exception $e) {
    echo "Couldn't connected to Redis";
echo $e->getMessage();
}

祝您好运!:)

于 2014-09-07T09:33:34.573 回答