首页 > 解决方案 > Php Redis extension not working on wampserver windows10

问题描述

I have done the following steps to enable php_redis extension on my wampserver X64. Thread Safety was enabled.

  1. Downloaded the Zip File from https://pecl.php.net/package/redis/5.2.2/windows this link.

  2. Extract the zip file, copied php_redis.dll in wamp64\bin\php\php7.3.12\ext\ directory.

  3. Added extension=php_redis.dll in php.ini file.

  4. Re-started the wamp Server.

Still I couldn't find redis on phpinfo().

When I check redis extension from WampServer tray icon, it showed me the following error:

The 'php_redis.dll' extension file exists but there is no 'extension=php_redis.dll' line in php.ini.

What am I missing here?

Php Version= 7.3.12, Windows 10 x64.

Update

I have re-installedwamp server, C++ redistributables and followed the same steps to enable php_redis extension. Now the previous error disappeared.

However, when I tried to use Redis on my code, it still shows error!

This time, I am getting the following error from my php error log:

[05-Jun-2020 12:45:17 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'redis' (tried: c:/wamp64/bin/php/php7.3.12/ext/redis (The specified module could not be found.), c:/wamp64/bin/php/php7.3.12/ext/php_redis.dll (The specified procedure could not be found.)) in Unknown on line 0

标签: phprediswampserver

解决方案


请仔细按照以下步骤操作。

步骤 1. 打印phpinfo()

步骤 2. 检查 PHP 版本(例如 PHP 版本 7.4.0)并访问https://pecl.php.net/package/redis站点并根据您的 PHP 版本选择包。例如对于 PHP 7.4,https://pecl.php.net/package/redis/5.2.2/windows

第 3 步。在phpinfo(),搜索“线程安全”中检查它是启用还是禁用。如果启用,您需要下载 Thread Safe (TS)。否则,请下载非线程安全 (NTS)

第 4 步。现在解压缩 zip 并获取php_redis.dll并将其粘贴到 Wamp Server( wamp64\bin\php\php7.x.x\ext\)中的 php 扩展文件夹中

第 5 步。添加extension=php_redis.dllphp.ini通过单击 Wamp->PHP->php.ini)

步骤 6. 重新启动 WAMP 服务器并redisphpinfo().


推荐阅读