因为升级到了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' => ,
        )
    )
);

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下安装memcache

    Windows7 x64在Wamp集成环境下安装Memcache,步骤如下: 1.Memcached-win64 下载 (1)最新版本下载:http://blog.couchbase.com/memc ...

  2. win7 64位系统下安装autoitlibrary库遇到问题解决

    转载来自http://blog.sina.com.cn/s/blog_53f023270101skyq.html 今天需要在win7 64位系统下安装autoitlibrary库,起初安装好了robo ...

  3. win7(windows 7)系统下安装SQL2005(SQL Server 2005)图文教程( Win7 SQL Server2005 安装教程)

    win7(windows 7)系统下安装SQL2005(SQL Server 2005)图文教程 由于工作需要,今天要在电脑上安装SQL Server 2005.以往的项目都是使用Oracle,MS的 ...

  4. PHP7 下安装 memcache 和 memcached 扩展

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

  5. 【Flutter 1-2】在 Windows 10下安装Flutter+Dart+Android Studio 配置Flutter开发环境

    在 Windows 10下安装Flutter+Dart+Android Studio 配置Flutter开发环境 文章首发地址 配置环境变量 由于部分网站被墙的原因,我们需要先配置Flutter国内镜 ...

  6. Windows下安装Memcache

    安装步骤的时候只需要做两步: 第一步:安装memcache.exe 服务. 第二步:安装php_memcache.dll扩展,让php支持memcache. 1.安装 memcache.exe 服务 ...

  7. windows下安装memcache的基本步骤

    本文主要解决的是window下memcached的安装的问题,在使用的过程中经常会被第一步环境的配置搞混,本文结合我的配置过程和遇到的问题,做一个总结 1,开启php memcache的扩展,在文件  ...

  8. MAMP PRO 下安装 memcache

    本人PHP用的是 5.5.10,编译 memcache 模块需要用到 php 源码,mamp 不自带,到 php 官网下一个 php-5.5.11.tar.gz, 解压后,生成 zend_config ...

  9. windows系统IIS环境下安装memcache的方法

    1.首先下载memcached-1.2.1-win32.zip 下载地址http://download.csdn.net/detail/u011986449/8110579 这下是windows下的版 ...

随机推荐

  1. 为什么 c = tf.matmul(a, b) 不立即执行矩阵乘法?

    在 TensorFlow Python API 中,a.b 和 c 是  tf.Tensor  对象.Tensor 对象是指令结果的符号句柄,但它实际上并不存放指令的输出值.相反,TensorFlow ...

  2. preg_match用法

    preg_match 利用 preg_match(),我们可以完成字符串的规则匹配.如果找到一个匹配,preg_match() 函数返回 1,否则返回 0.还有一个可选的第三参数可以让你把匹配的部分存 ...

  3. MongodDB---初识

    NoSQL介绍 一.NoSQL简介 NoSQL,全称是”Not Only Sql”,指的是非关系型的数据库. 非关系型数据库主要有这些特点:非关系型的.分布式的.开源的.水平可扩展的. 原始的目的是为 ...

  4. Loader Lock引起的一个Bug

    在Windows中,让程序模块化实现的一种方式,就是让事实上现为动态链接库. 然后在主程序启动的时候隐式或者显示的去载入动态链接库.可是假设不恰当的编写动态链接库的DllMain函数,将会引起意想不到 ...

  5. Linux Crontab内环境变量与Shell环境变量的关系及解决问题的办法

    为了定时监控Linux系统CPU.内存.负载的使用情况,写了个Shell脚本,当达到一定值得时候,发送邮件通知.需要用到Crontab的定时任务去执行这个脚本,但是发现通过命令(./test.sh)执 ...

  6. 向量运算 与 JavaScript

    二维向量都包含两个值:方向(direction)及大小(magnitude)   这两个值可以表达出各种各样的物理特性来,比如力和运动.如两个物体间的碰撞检测.   向量的大小   虽说二维向量是对大 ...

  7. C#基础第四天-作业-Hashtable-list<KeyValuePair>泛型实现名片

    1.名片集: 名片集实现功能:不限定集合实现 增加,查询,查询全部,删除 功能,需求条件: 根据姓名去(查询/删除)某一行数据.指定:姓名,年龄,性别,爱好,联系方式. 采用技术:Hashtable- ...

  8. glide 镜像

    运行glide install 失败  国内墙的原因, 某些网站上不去 [ERROR]Update failed for golang.org/x/crypto: Cannot detect VCS ...

  9. tensorflow中使用Batch Normalization

    在深度学习中为了提高训练速度,经常会使用一些正正则化方法,如L2.dropout,后来Sergey Ioffe 等人提出Batch Normalization方法,可以防止数据分布的变化,影响神经网络 ...

  10. 如何在PHP项目中使用phinx进行数据迁移和建表

    建表 phinx\bin\phinx.bat migrate -e production 建设 phinx.yml文件 paths: migrations: %%PHINX_CONFIG_DIR%%\ ...