首先,我是PEAR和Predis的新手...我想在Windows 7上安装Predis,以及到目前为止我所做的... 我在C:/ Redis上的计算机上安装了Redis。 PEAR位于\ wamp \ bin \ php \ php5.3.10中,并且已成功安装。 现在我尝试使用
安装Predispear 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
答案 0 :(得分:1)
首先,在php.ini中启用php_openssl 我遵循的步骤是,
编写此文件composer.json
{“require”:{ “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();
}
祝你好运! :)