search
HomeBackend DevelopmentPHP Tutorial在win系统安装配置 Memcached for PHP 5.3 图文教程_PHP

如何在windows系统上让php支持memcached呢?

第一步:安装 Memcached 服务
第二步:让php加载memcached.dll扩展

以下资料参考:
1、Installing Memcached for PHP 5.3 on Windows 7
2、Windows 下Memcache安装配置 + 没有成功加载memcached

详情步骤如下:

第一步:安装 Memcached 服务

1、下载 Memcached Win32 (点我下载)

2、解压下载的文件到自定义目录,例如(C:\webserver\memcached)
解压后该目录下仅有一个 memcached.exe 在该目录下

3、使用管理员权限运行命令行(cmd)

4、安装

代码如下:


memcached -d install

提示:如果提示 MSVCP71.dll 不存在的错误,则访问这里(戳我)

5、启动

代码如下:


memcached -d start

6、检查安装路径(可以不理会)

代码如下:


wmic process get description, executablepath | findstr memcached.exe

显示:
memcached.exe    C:\webserver\memcached\memcached.exe

到这里,memcached 服务安装完毕

第二步:让php加载memcached.dll扩展

1、下载VC9版本的memcached.dll
线程安全版
http://downloads.php.net/pierre/php_memcache-2.2.6-5.3-vc9-x86.zip
非线程安全版 fastcgi运行php的方式
http://downloads.php.net/pierre/php_memcache-2.2.6-5.3-nts-vc9-x86.zip

2、解压缩得到 php_memcache.dll ,并拷贝到php的扩展目录 C:\webserver\php5.3nts\ext

3、编辑 php.ini ,在其底部加入

代码如下:


[memcache]
extension=php_memcache.dll
;一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,
;它能够用来存储各种格式的数据,包括图像、视频、文件以及数据库检索的结果等。
;是否在遇到错误时透明地向其他服务器进行故障转移。
memcache.allow_failover = 0
;接受和发送数据时最多尝试多少个服务器,只在打开memcache.allow_failover时有效。
memcache.max_failover_attempts = 20
;数据将按照此值设定的块大小进行转移。此值越小所需的额外网络传输越多。
;如果发现无法解释的速度降低,可以尝试将此值增加到32768。
memcache.chunk_size = 8192
;连接到memcached服务器时使用的默认TCP端口。
memcache.default_port = 11211
;控制将key映射到server的策略。默认值"standard"表示使用先前版本的老hash策略。
;设为"consistent"可以允许在连接池中添加/删除服务器时不必重新计算key与server之间的映射关系。
memcache.hash_strategy = "consistent"
;控制将key映射到server的散列函数。默认值"crc32"使用CRC32算法,而"fnv"则表示使用FNV-1a算法。
;FNV-1a比CRC32速度稍低,但是散列效果更好。
memcache.hash_function = "crc32"
;以下2个设置见上上面的[session]
;当值为memcache时标记使用memcache作为session处理器
;session.save_handler = "files"
;定义用于通话存储的各服务器链接的分隔符号,例如:“tcp://host1:11211, tcp://host2:11211”
;每服务器个链接可以包含被接受于该服务器的参数,比较类似使用 Memcache::addServer() 来添加的服务器
;例如:“tcp://host1:11211?persistent=1&weight=1&timeout=1& amp;retry_interval=15”
;session.save_path = ""

4、重启IIS(命令行中运行)

代码如下:


iisreset /restart

至此,memcached配置完成

以上就是本文的全部内容了。希望大家能够喜欢。

Statement
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
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

PHP and Python are both high-level programming languages ​​that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

See all articles

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!