Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
275 views
in Technique[技术] by (71.8m points)

php - How to enable memcache in WAMP

How to install memcache in WAMP?

I don't find any php_memche in php.ini.

What do I do now?

@Ryan

thanks for your step, now memcache enabled in WAMP, i have cross checked in the PHPINFO as well. memcache is displaying.

i have tried below example memcache sample. but throwing error.

<?php

$memcache = new Memcache;
$memcache->connect('localhost:8085', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>
";

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>
";

$get_result = $memcache->get('key');
echo "Data from the cache:<br/>
";

var_dump($get_result);

?>

Getting below notice error.

( ! ) Notice: Memcache::getversion() [memcache.getversion]: Server localhost:8085 (tcp 11211) failed with: Malformed version string (0) in C:wampwwwmemcachesample.php on line 7

What i missed...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here are the steps that worked for me:

Needed Files

Steps

  1. Copy MSVCP71.DLL, msvcr71.dll to C:windowssysWOW64
  2. Copy memcached.exe into C:memcached
  3. Click Windows-Key
  4. Type: CMD
  5. press: Ctrl-Shift-Enter
  6. Choose yes
  7. type: C:memcachedmemcached.exe -d install
  8. type: C:memcachedmemcached.exe -d start
  9. Copy php_memcache.dll to C:wampinphpphp5.3.4ext
  10. Restart Apache using Wamp controls
  11. Enable WAMP -> PHP -> PHP Extensions -> php_memcache

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...