How to enable memcache in WAMP
Here are the steps that worked for me:
Needed Files
memcached.exe
Direct LinkMSVCP71.DLL
Windows DLL Filesmsvcr71.dll
php_memcache.dll
Working memcache for PHP 5.3.4 OR REF
Steps
- Copy
MSVCP71.DLL
,msvcr71.dll
toC:\windows\sysWOW64
- Copy
memcached.exe
intoC:\memcached
- Click Windows-Key
- Type: CMD
- press: Ctrl-Shift-Enter
- Choose
yes
- type:
C:\memcached\memcached.exe -d install
- type:
C:\memcached\memcached.exe -d start
- Copy
php_memcache.dll
toC:\wamp\bin\php\php5.3.4\ext
- Restart Apache using Wamp controls
- Enable WAMP -> PHP -> PHP Extensions -> php_memcache
how to enable memcached in wamp in windows?
It looks like you are trying to connect MySql server without installing it. First you have to install a memcached server. You can use couchbase server with memcache bucket on Windows. IMHO it's the best port for Windows OS.
php_memcache.dll for WAMP 2.5 - PHP : 5.5.12 - Window8:64 Bit - VC11
The warning icon means one of 2 things when seen on the extension menu.
- There is a dll in the
ext
folder but there is no matchingextension=php_memcache.dll
entry in thePHP.INI
file. - There is a
extension=xxx.dll
in thePHP.INI
file but no matching dll in theext
folder.
So if you copied the dll into \wamp\bin\php\phpx.y.z\ext
folder then you need to add the extension=php_memcache.dll
to the PHP.INI
file. Remember this is not a default extension as you needed to download it yourself, so there will be no entry in the php.ini file for it either.
Also remember that you have to install MEMCACHED as the extension on its own is just an interface to the MEMCACHE service.
Also you will need the Thread Safe version of the memcache.dll to run with WampServers configuration of Apache and PHP.
Also make sure you have the right 32/64bit version of memcache.dll to match the version of WAMPServer you installed.
Also remember there are 2 php.ini
files, to edit the one used by Apache, use the wampmanager menus like so :-
wampmanager -> PHP -> php.ini
That will launch your editor on \wamp\bin\php\php{version}\phpForApache.ini
The other one \wamp\bin\php\php.ini
is only used by the PHP CLI (Command Line Interface) and will have no effect on what is loaded to an Apache instance.
WAMPSERVER php_memcache extension
Your extension probably not fit the compilation mode of wampserver.
Is it compiled with vc9 (visual 2008) and a non threads safe support ?
My wampserver (latest available) is compiled in VC6 TS.
To know this info check phpinfo() on line :
- Compiler
- Thread safety
php_memcache extension in wamp
There are two memcache extensions memcache and memcached.
It looks like you have installed memcached but you need memcache (i.e. php_memcache.dll)
Download Link: https://pecl.php.net/package/memcache/3.0.8/windows
Edit: Sorry I misread your post above and read that you had installed php_memcached.dll however you do actually say you've installed what I've suggested, are you sure the correct DLL has been added?
codeigniter2 deploy on windows 10 with wamp server, memcached error fix
I solved my problem:
Step 1 (enable Memcache in WAMPserver):
- download the Memcache package that compatible with your PHP version
and Wamp version (32 or 64 bits). I download the Thread Safe one. - extract the downloaded package then copy the php_memcache.dll into
your extensions folder of your PHP such as
C:\wamp64\bin\php\php5.6.40\ext. The php5.6.40 is your PHP folder. - open the php.ini file and search for extension=php_bz2.dll which
should be the first extension on the extensions list then copy
extension=php_memcache.dll and paste at the end of the extensions
list. - restart Wamp server
- now you should see the Memcache loaded when you visit
http://localhost
If the steps above don’t work, you just open the error log file at the logs folder at the root directory and check the error there.
Step 2 (Changes in /system/libraries/Cache/drivers/Cache_memcached.php):
Using this github link, i made changes in Cache_memcached.php:
Replace this:
$this->_memcached = new Memcached();
With this:
if (class_exists('Memcached')) {
$this->_memcached = new Memcached();
}
else if (class_exists('Memcache')) {
$this->_memcached = new Memcache();
}
else {
log_message('error', 'Failed to create object for Memcached Cache; extension not loaded?');
return FALSE;
}
And replace this:
if ( ! extension_loaded('memcached'))
With this:
if ( ! extension_loaded('memcached') && ! extension_loaded('memcache'))
Then delete (if exists):
$this->_memcached->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
$this->_memcached->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
And this (if exists):
$this->_memcached->setOption(Memcached::OPT_PREFIX_KEY, $prefix);
Step 3 (Refresh Database):
- Delete and create new database
- import data (if big data you can import it via wamp server mysql
console "use dbname; source c:/wamp64/www/dataname.sql") - restart wamp server
Related Topics
Type Hinting - Specify an Array of Objects
Php: Using a Variable Inside a Double Quotes
Can You Put PHP Inside PHP with Echo
Mysql_Fetch_Array() Expects Parameter 1 to Be Resource Problem
Executing Multiple SQL Queries in One Statement with PHP
Echo a Multidimensional Array in PHP
Check If Download Is Completed
Rotate Array Elements to the Left (Move First Element to Last and Re-Index)
Mysqli Query Results to Show All Rows
Combinations, Dispositions and Permutations in PHP
How to Access an Object Attribute That Starts with a Number
Initialize Class Property with an Anonymous Function
PHP Pdo Prepare Repetitive Variables
How to Use Pdo's Prepared Statement for Order by and Limit Clauses
Warning: Session_Start() Failed: No Such File or Directory
When Using Gmail for Smtp, Can You Set a Different "From" Address
PHP Default Function Parameter Values, How to 'Pass Default Value' for 'Not Last' Parameters