Table of Contents
Windows下Memcached的安装配置方法
Memcached的基本参数设置:
Home Backend Development PHP Tutorial windows装配配置php+memcached

windows装配配置php+memcached

Jun 13, 2016 pm 12:53 PM
data gt memcache memcached php

windows安装配置php+memcached

Windows下Memcached的安装配置方法

1、将第一个包解压放某个盘下面,比如在c:\memcached。

2、在终端(也即cmd命令界面)下输入 'c:\memcached\memcached.exe -d install' 安装。

3、再输入: 'c:\memcached\memcached.exe -d start' 启动。(需要注意的: 以后memcached将作为windows的一个服务每次开机时自动启动。这样服务器端已经安装完毕了)。

4、下载php_memcache.dll 文件,把它放入php文件夹的ext目录中。

5、在php.ini加入一行引用扩展,代码如下:

extension=php_memcache.dll

6、接着在 php.ini 文件里加上:

[Memcache]
memcache.allow_failover = 1
memcache.max_failover_attempts=20
memcache.chunk_size =8192
memcache.default_port = 11211 
Copy after login

?最好就放在刚才写 "extension=php_memcache.dll" 的下面。(这是默认的一些配置)

7、重新启动Apache,然后查看一下phpinfo,如果有 memcache 的说明,那么就说明安装成功啦!

  写一个 example.php 文件(更多使用方法可以参看 PHP 手册里的 Memcache Functions 使用说明),测试代码如下:

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

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

$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>\n"; 

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

var_dump($get_result); 

?> 
Copy after login

?如果输出如下,则测试成功:

Server's version: 1.4.5
Store data in the cache (data will expire in 10 seconds)
Data from the cache:
object(stdClass)#3 (2) { ["str_attr"]=> string(4) "test" ["int_attr"]=> int(123) } 
Copy after login

?

Memcached的基本参数设置:

  • -p 监听的端口
  • -l 连接的IP地址, 默认是本机
  • -d start 启动memcached服务
  • -d restart 重起memcached服务
  • -d stop|shutdown 关闭正在运行的memcached服务
  • -d install 安装memcached服务
  • -d uninstall 卸载memcached服务
  • -u 以的身份运行 (仅在以root运行的时候有效)
  • -m 最大内存使用,单位MB。默认64MB
  • -M 内存耗尽时返回错误,而不是删除项
  • -c 最大同时连接数,默认是1024
  • -f 块大小增长因子,默认是1.25
  • -n 最小分配空间,key+value+flags默认是48
  • -h 显示帮助
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles