'memcached not getting loaded for php7
I am using Easyphp-DevServer-17 and PHP7 ,I want to use "memcached" with PHP-7.1 , I downloaded memcached dll files from the following link php 7 memcahced
I tried adding dll files to ext folder in php 7 but phpinfo file doesn't reflect it and i tried following code
$servers = array(array('localserver', 11212));
$memcacheD = new Memcached;
but it throws following error "Fatal error: Uncaught Error: Class 'Memcached' not found" Please help me on this issue as i am new to php and struggling to load memcached extension
Solution 1:[1]
First of all ensure you have the correct version of memcacheD. Most of the versions for Windows out there are memcache, without the D at the end, even the name of the libraries are called memcacheD. It's very misleading but I have added the link to the correct version below. To clarify, memcache and memcacheD are not the same and cannot be interchanged.
- Run phpinfo() and make notations of Compiler, Architecture, Thread Safety, you will need this to get the correct version of the DLL.
- Download the correct memcacheD version from https://github.com/lifenglsf/php_memcached_dll There are 2 files, the php extension DLL and the lib DLL. You need both.
- Save the php extension DLL in your easyPHP folder, in my case was
\eds-binaries\php\php713vc14x86x220414190951\ext
. - Enable the extension in php.ini, I renamed the DLL so in my case I had to add the line
extension=php_memcached.dll
- Save
libmemcached.dll
in C:\windows - Reload Apache to ensure the config is refreshed.
And that's it. Now run phpinfo() again and should show there. If it's not working check Apache error log, it will tell you if the DLL failed to load. If you get the "not a Win32 application" message it means you didn't download the correct DLL.
Remember you also have to have the service running, memcached.exe -d start
from cmd should do.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |