因为升级到了5.3.10,所以之前的dll不能使用了,弄了好久,终于还是在老外的博客上找到了解决方法:

(环境是win7+php5.3.10+win32)

1、解压附件memcached到某个目录,本例中解压在F:\

2、解压附件中的memcached-win32-1.4.4-14.zip

3、进入cmd,输入:

F:\memcached\memcached-win32-1.4.4-14\memcached.exe -d install

回车

F:\memcached\memcached-win32-1.4.4-14\memcached.exe -d start

4、解压php_memcache-php-5.3.10.0-r2-win32-vc9-standard.zip,并且复制到php5.3.10\ext中(假设你使用的是WAMP集成环境,应该就是 \wamp\bin\php\php5.3.10\ext)

5、在php.ini中添加一行:”extension=php_memcache.dll

6、重启apache,打开phpinfo就看到memcache了!

测试代码如下:

<?php
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211);
$memcache->set('mem_key', 'Hello Memcache!', 0, 180);
$val = $memcache->get('mem_key');
echo $val;
?>

以下是该老外的博客原文:

After spending so much time trying to locate the information on the net i thought i'd share all the details on how to successfully run memcached on windows. As the information on the net changes from day to day i will be making available all the files in zip format at the end of this tutorial as they just work.

First you need the software the latest ones can be found here or download the file at the bottom of this tutorial.

Memcached : http://blog.couchbase.com/memcached-144-windows-32-bit-binary-now-available
PHP Memcached interface : http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/

Memcached

Create a directory in the root of your hard drive as follows C:\memcached\ and place the file from the zip in it.
Open up a command prompt and navigate to the location of the files by typing in CD \memcached
To install as a service type in memcached -d install
To start the service type in memcached -d start

Other usefull information regarding memcached.
To stop the service type in memcached -d stop
To uninstall the service type in memcached -d uninstall
To set memory limit (Default is 64MB) type in while memcache is running memcached -m 2048 this makes 2GB of cache avaiable.

While running memcache as a service your be unable to add the -m 2048 on the service start up.

Control Panel -> Administrative tools -> Services

To add the extra memory allocation your need to edit the registry to add the information.

Run -> Regedit
HKEY_LOCAL_MACHINE -> SYSTEM -> CURRENTCONTROLSET -> SERVICES -> MEMCACHED
Add -m 2048 (The value i'm using is 2GB but pick what you wish to allocate) on the end of the imagepath.

If you now go back to the service section you should now see .

If your not seeing this result a computer restart is required. You now have memcached running.

PHP Memcached interface

Unzip and place memcache.php on your server were your site files are located.

Other usefull information regarding PHP Memcached interface.
To access the interface your be asked for username and password details these are as follows.
Username : memcache
Password : password

If you edit the file in notepad you can change the password details on lines 21 -> 22.

PHP:
define('ADMIN_USERNAME','memcache');    // Admin Username
define('ADMIN_PASSWORD','password');      // Admin Password

If you don't wish to have a password comment out lines 35 -> 45 by placing // at the front of each line.

PHP:
//if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
//          $_SERVER['PHP_AUTH_USER'] != ADMIN_USERNAME ||$_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD) {
//            Header("WWW-Authenticate: Basic realm=\"Memcache Login\"");
//            Header("HTTP/1.0 401 Unauthorized");
//
//            echo <<<EOB
//                <html><body>
//                <h1>Rejected!</h1>
//                <big>Wrong Username or Password!</big>
//                </body></html>
//EOB;
//            exit;

You also need to change the information on lines 28 -> 29 to reflect your system.

PHP:
$MEMCACHE_SERVERS[] = 'mymemcache-server1:11211'; // add more as an array
$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array

An working example is as such.

PHP:
$MEMCACHE_SERVERS[] = 'localhost:11211'; // add more as an array
// $MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array

You should be able to view the interface at the address you placed the file http://mysite.com/memcache.php you should now see this.
However is won't work till the rest of the information is followed.

PHP files

Check you php/ext/ folder for the file php_memcache.dll
If this file exists then all well and good if not add your php version from the zip file below which contains.

1. php_memcache-php-5.3.10.0-r1-win32-vc9-standard-fcgi
2. php_memcache-php-5.3.10.0-r2-win32-vc9-standard

Now that php-memcahce.dll has eather been located or added to your system find your php.ini file and add this code to the bottom.

Code:
[Memcache]
extension="php_memcache.dll"
memcache.allow_failover="1"
memcache.max_failover_attempts="20"
memcache.chunk_size="8192"
memcache.default_port="11211"
memcache.hash_strategy="standard"
memcache.hash_function="crc32"
session.save_handler="files"
session.save_path=""

Restart the server and memcache will be running check this by viewing your phpinfo().

Getting your sites to use the cache.

Some sites will require extra plugins to be installed for the memcache to start working. If your running a dynamic site like wordpress or others check if you require any additional plugins to activate this feature.

To activate the memcache feature in Xenforo add this code to your /library/config.php

PHP:
$config['cache']['enabled'] = true;
$config['cache']['frontend'] = 'Core';
$config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
 
$config['cache']['cacheSessions'] = true;
 
$config['cache']['backend'] = 'Memcached';
$config['cache']['backendOptions'] = array(
    'compression' => false,
    'servers' => array(
        array(
            // your memcached server IP /address
            'host' => 'localhost',
 
            // memcached port
            'port' => 11211,
        )
    )
);

While your site is in use check back to your http://mysite.com/memcache.php You should see the hit's start to rise (refresh data).

You now have a fully working version of memcache.

Files in the Zip

1. memcache.php - (PHP Memcached interface)
2. memcached-win32-1.4.4-14 - (Core windows program)
3. php_memcache-php-5.3.10.0-r1-win32-vc9-standard-fcgi - (php_memcache.dll)
4. php_memcache-php-5.3.10.0-r2-win32-vc9-standard - (php_memcache.dll)
5. php_ini.txt - (Text Document)
6. xenforo_config_php.txt - (Text Document)

老外原文:http://fixitwizkid.com/threads/installing-memcached-for-windows-on-apache-php-and-xenforo.8905/

附件在这里:http://files.cnblogs.com/whoknows/memcached.zip

win7+php5.3.10下安装memcache (转)相关推荐

  1. Win7/10下安装Bookdown教程

    Win7/10下安装Bookdown教程 一.前言 二.安装前准备 (一)R语言环境 (二)RStudio (三)TinyTex (四)Pandoc 三.软件安装 (一)R环境安装 (二)RStudi ...

  2. 在ubuntu下安装memcache

    使用Memcache的网站一般流量都是比较大的,为了缓解数据库的压力,让Memcache作为一个缓存区域,把部分信息保存在内存中,在前端能 够迅速的进行存取. 下面来介绍一下如何安装和使用memcac ...

  3. LAMP(httpd 2.4.1 + mysql-5.5.19 + php-5.3.10)编译安装

    LAMP(httpd 2.4.1+mysql-5.5.19+php-5.3.10)编译安装 一.安装开发包组: yum groupinstall "Development Tools&quo ...

  4. 解决win7 64位操作系统下安装PL/SQL后连接报错问题: make sure you have the 32 bits oracle client installed

    解决win7 64位操作系统下安装PL/SQL后连接报错问题: make sure you have the 32 bits oracle client installed 参考文章: (1)解决wi ...

  5. window下安装Memcache

    说来惭愧,从事PHP已经1年多了,但是很多PHP相关的知识都不知道. 前一阵子看到网上流传了很久的面试题,才了解到原来还有memcache这么个东西-_-. memcache 具体是什么Google一 ...

  6. ubuntu15.10下安装opencv2.4.9python上调用opencv库

    对于centos,可以参考:Install OpenCV-Python in Fedora 如果IPP难以下载可以在cmake时禁掉它,只需:cmake -DWITH_IPP=OFF OpenCV3. ...

  7. PHP7 下安装 memcache 和 memcached 扩展

    转载自:https://www.jianshu.com/p/c06051207f6e Memcached 是高性能的分布式内存缓存服务器,而PHP memcache 和 memcached 都是 Me ...

  8. linux交叉编译出现的问题,,Ubuntu 14.10下安装GCC交叉编译器遇到问题及解决方法

    Ubuntu 14.10下安装GCC交叉编译器遇到问题及解决方法 一.下载gcc-arm-none-eabi-4_9 安装成功后上报错误: ./gcc-arm-none-linux-gnueabi-g ...

  9. TinyOS 学习第一周-Ubuntu-10.10下安装TinyOS-2.1.1

    1           Ubuntu-10.10下安装TinyOS-2.1.1 1背景:TinyOS主要有三种运行环境: <1> Windows环境: 虚拟机(Oracle VM Visu ...

最新文章

  1. css animation动画完成后隐藏_如何使用CSS实现旋转地球动画效果
  2. 无法链接到SQL Server远程服务器的解决
  3. AD域服务器卸载---WindowsServer2012R2
  4. Java 原子类的操作 AtomicInteger
  5. ​Linux下C如何调用PCI Lib函数
  6. java home not set_Error: JAVA_HOME is not set and could not be found.
  7. 《零基础看得懂的C语言入门教程 》——(七)C语言的循环分分钟上手
  8. java定义一个方法,返回一个整数数组的和
  9. php mysql 验证码代码_PHP_PHP 验证码的实现代码,checkcode.php 生成验证码图片, - phpStudy...
  10. 深入理解JVM虚拟机-Ubuntu中安装openJDK
  11. 【初级01】java JVM核心技术(1):字节码、类加载器、GC机制
  12. CodeForces - 468A 24 Game
  13. 安装Ubuntu最后重启出错Write through
  14. 乒乓球单循环赛_乒乓球循环赛制比赛方法
  15. python 网络调试助手
  16. c语言抠图程序蓝屏,一种蓝屏抠图方法
  17. Aggressive cows 基础二分
  18. 移动交互提示语设计(转)
  19. html 斜体变正体怎么变,WORD中编辑公式时怎样将斜体改成正体
  20. 树莓派实现温控风扇智能降温

热门文章

  1. [Google Guava] 1.3-常见Object方法
  2. 好书推荐系列之:你在为谁工作
  3. [转载]CentOS 7安装Gnome GUI 图形界面
  4. 用树莓派从0开始打造属于自己的服务器
  5. 根据空间线上的两点生成圆柱体 算法
  6. 第18章 多线程----线程同步
  7. C#中的Params、ref、out的区别
  8. MySQL外键约束On Delete、On Update各取值的含义
  9. wds和dhcp分开做需要注意问题
  10. 基于Debian9.3安装OpenVAS9.0(kali源)