php Windows 7 64 位 xampp 上的 phpredis

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10178600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 21:34:59  来源:igfitidea点击:

phpredis on windows 7 64bit xampp

phpwindowsredis64-bit

提问by Giedrius

I'm trying to make Redis work on my windows machine for development purposes. I already made Redis up and running on my Ubuntu 10.04 server with phpredis client.

我正在尝试让 Redis 在我的 Windows 机器上运行以进行开发。我已经使用 phpredis 客户端在我的 Ubuntu 10.04 服务器上启动并运行了 Redis。

At the moment on my windows machine i can start Redis server, because it requires no installation and it is good enaugh for development, but I can't figure out how to install phpredis. It seems very confusing, I already spend two days working on this and no result.

目前在我的 Windows 机器上我可以启动 Redis 服务器,因为它不需要安装并且对开发来说已经足够了,但是我不知道如何安装 phpredis。看起来很混乱,我已经花了两天时间在这方面工作,但没有结果。

I have cloned source files with Git, but i did that using Git Bash, but that was last command who worked in the same way as ubuntu. I also have downloaded two .dll files, one with 'ts' and another with 'nts', have no idea what is the difference :/

我已经使用 Git 克隆了源文件,但是我使用 Git Bash 做到了这一点,但这是与 ubuntu 以相同方式工作的最后一个命令。我还下载了两个 .dll 文件,一个带有“ts”,另一个带有“nts”,不知道有什么区别:/

http://commandperls.com/install-phpredis/there is manual how to install phpredis, but it works only on ubuntu for my. I'm very newbie for a command line and I'm not sure if this even suppose to work on windows, like with cmd or git bash.

http://commandperls.com/install-phpredis/有如何安装 phpredis 的手册,但它仅适用于我的 ubuntu。我是命令行的新手,我不确定这是否适用于 Windows,例如 cmd 或 git bash。

So my question is, how can I make that phpredis work on windows? Is there is any way to make that happen? I know there is Predis and I already tried that one, but because I'm planning to use phpredis on my server, i would like to use same on development machine.

所以我的问题是,我怎样才能让 phpredis 在 Windows 上工作?有没有办法做到这一点?我知道有 Predis 并且我已经尝试过那个,但是因为我打算在我的服务器上使用 phpredis,所以我想在开发机器上使用它。

回答by Giedrius

Found it! Apologizing for misapprehension, but all this situation is really confusing for guy who such a little about servers management. Anyway, below is my solution.

找到了!为误解道歉,但所有这些情况对于对服务器管理如此了解的人来说真的很困惑。无论如何,以下是我的解决方案。

http://code.google.com/p/pecl-win/downloads/detail?name=php_redis-2.1.3-5.3-ts.dll&can=2&q=

http://code.google.com/p/pecl-win/downloads/detail?name=php_redis-2.1.3-5.3-ts.dll&can=2&q=

Link above provides .dll file, which in my case must be copied to: C:\xampp\php\extand add a line in to php.ini file extension=php_redis.dlland lastly restart apache2 service.

上面的链接提供了 .dll 文件,在我的情况下必须将其复制到:C:\xampp\php\ext并在 php.ini 文件中添加一行extension=php_redis.dll,最后重新启动 apache2 服务。

And that's it, nothing has to be installed, as long as redis server already up and running this will provide connection between php and redis!

就是这样,不需要安装任何东西,只要 redis 服务器已经启动并运行,这将提供 php 和 redis 之间的连接!

2020-05-06 update

2020-05-06 更新

Seems like previous url only contains outdated .dll files. @Niz provided in the comments an updated url where you can download the correct version of redis DLL for your windows. Make sure to download the one that matches your redis and php versions.

似乎以前的 url 只包含过时的 .dll 文件。@Niz 在评论中提供了一个更新的 url,您可以在其中为您的 Windows 下载正确版本的 redis DLL。确保下载与您的 redis 和 php 版本匹配的那个。

https://pecl.php.net/package/redis

https://pecl.php.net/package/redis

回答by Elwin

You can still find up to date compiled dll binaries of Redis(and many more) at the following location: http://windows.php.net/downloads/pecl/releases/redis/2.2.7/

您仍然可以在以下位置找到 Redis(以及更多)的最新编译 dll 二进制文件:http: //windows.php.net/downloads/pecl/releases/redis/2.2.7/

    # php -i | find "Architecture"
    # php -i | find "Thread"

回答by Manish Gadhock

This worked for me :

这对我有用:

Answer Referred from this Article: https://www.linkedin.com/pulse/using-redis-windows-php-shekhar-joshi/

本文引用的答案https: //www.linkedin.com/pulse/using-redis-windows-php-shekhar-joshi/

Check all the information from phpinfo() such as x86 , php version and Thread Safety.

检查来自 phpinfo() 的所有信息,例如 x86 、php 版本和线程安全。

Useful Portion from the Article :

文章中有用的部分:

Download PECL extension from https://pecl.php.net/package/redis/2.2.7/windows, you need to know which version would work for you. First of all check out your php version and know whether thread safety is enabled or not(you can do this by using phpinfo()). Download the appropriate version of the dll, for thread safety enabled use ts version otherwise use nts version. Extract the contents and copy the .dll file in xamp/php/ext. Next, open the php.ini file located at(xampp/php) and add this string extension="php_redis.dll" together with other extensions.

https://pecl.php.net/package/redis/2.2.7/windows下载 PECL 扩展,您需要知道哪个版本适合您。首先检查你的 php 版本并知道是否启用了线程安全(你可以使用 phpinfo() 来做到这一点)。下载相应版本的 dll,为了启用线程安全,请使用 ts 版本,否则使用 nts 版本。提取内容并将 .dll 文件复制到 xamp/php/ext 中。接下来,打开位于 (xampp/php) 的 php.ini 文件并将此字符串 extension="php_redis.dll" 与其他扩展名一起添加。

回答by Drupalicus

Php 7 with redis support for xammp there are new binaries available in: https://windows.php.net/downloads/pecl/releases/redis/

带有对 xammp 的 redis 支持的 PHP 7 有新的二进制文件可用:https://windows.php.net/downloads/pecl/releases/redis/