search
HomeBackend DevelopmentPHP TutorialDebian装配memcached和php5-memcache模块

Debian安装memcached和php5-memcache模块

1、安装memcached服务及php扩展
apt-get install memcached php5-memcached php5-memcache

2、查看是否安装好memcached服务
ps aux | grep memcached
可以发现安装完memcached是自动启动了的。也可以如下命令查看:
netstat -tap | grep 'memcached'

3、如需修改配置文件
请前往:/etc/memcached.conf
修改完重启
pkill memcached
/usr/bin/memcached restart -p 11211 -u nobody -l 127.0.0.1
最好在网上找个shell脚本,可以直接memcache start

4、最后web server重启下,apache或者nginx的fast-cgi
/etc/init.d/apache2 restart

最后来个简单的例子吧:

  1. $mem =newMemcache;
  2. $mem->connect("localhost",11211);
  3. $mem->set('test','hello world',0,60);
  4. echo $mem->get('test');

如果能看到hello word,就真的ok了。

?

更多请支持:http://www.webyang.net/Html/web/article_171.html

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
Memcached缓存技术对于PHP中的Session处理的优化Memcached缓存技术对于PHP中的Session处理的优化May 16, 2023 am 08:41 AM

Memcached是一种常用的缓存技术,它可以使Web应用程序的性能得到很大的提升。在PHP中,常用的Session处理方式是将Session文件存放在服务器的硬盘上。但是,这种方式并不是最优的,因为服务器的硬盘会成为性能瓶颈之一。而使用Memcached缓存技术可以对PHP中的Session处理进行优化,提高Web应用程序的性能。PHP中的Session处

PHP8.0中的缓存库:MemcachedPHP8.0中的缓存库:MemcachedMay 14, 2023 am 08:16 AM

PHP8.0中的缓存库:Memcached随着互联网的快速发展,现代应用程序需要高效可靠的缓存技术来提高性能和处理大量数据。由于PHP的流行和开源特性,PHP缓存库已经成为了Web开发社区的一个必备工具。Memcached是一种广泛使用的开源高速内存缓存系统,它能处理数百万个同时连接的缓存请求,可以用于许多不同类型的应用程序,例如社交网络、在线

PHP与Memcached数据库备份与恢复PHP与Memcached数据库备份与恢复May 15, 2023 pm 09:12 PM

随着互联网的快速发展,大规模MySQL数据库备份和恢复成为各大企业和网站必备的技能之一。而随着Memcached的广泛应用,如何备份和恢复Memcached也成为了一个重要的问题。PHP作为Web开发的主力语言之一,在处理备份和恢复MySQL和Memcached上拥有独特的优势和技巧。本文将详细介绍PHP处理MySQL和Memcached备份与恢复的实现方法

使用PHP和Memcached进行缓存管理使用PHP和Memcached进行缓存管理May 23, 2023 pm 02:21 PM

随着网络应用的不断增加和数据量的不断膨胀,数据的读写效率成为影响应用性能的重要因素之一。而缓存技术的应用则可以很好地解决这个问题。在PHP应用中,Memcached是最常用的缓存服务器。Memcached是一个高性能的分布式内存对象缓存系统,可以将常用的数据存储在内存中,提高数据检索的效率。本文将介绍如何使用PHP和Memcached进行缓存管理,以及如何优

利用Memcached缓存技术对于PHP中的音视频播放进行优化利用Memcached缓存技术对于PHP中的音视频播放进行优化May 17, 2023 pm 04:01 PM

随着互联网技术的不断发展,音视频资源已经成为了互联网上非常重要的一种内容形式,而PHP作为网络开发中使用最广泛的语言之一,也在不断地应用于视频和音频播放领域。然而,随着音视频网站的用户日益增加,许多网站已经发现了一个问题:在高并发的情况下,PHP对于音视频的处理速度明显变缓,会导致无法及时播放或者播放卡顿等问题。为了解决这个问题,Memcached缓存技术应

PHP与Memcached性能监控PHP与Memcached性能监控May 15, 2023 pm 09:51 PM

随着现代互联网应用的快速发展,用户体验对于一个应用的成功至关重要。如何保证应用的高性能和高可用性,成为了开发人员需要解决的重要问题之一。PHP作为一种广泛应用的编程语言之一,它的性能监控和优化也是非常重要的。Memcached是一个高性能、分布式的内存对象缓存系统,可以帮助应用提高性能和扩展性。本文将介绍如何使用PHP和Memcached实现性能监控的方法。

PHP实现Memcached数据库集群的方法PHP实现Memcached数据库集群的方法May 15, 2023 pm 03:31 PM

随着互联网应用的快速发展,数据存储和处理变得越来越庞大和复杂。在这样的背景下,Memcached作为一款高性能、轻量级的分布式内存缓存系统,逐渐成为互联网应用领域中不可或缺的一部分。在PHP语言中,Memcached可以通过扩展内置的Memcached类实现与Memcached服务器的交互,而在实际生产环境中,我们需要通过搭建Memcached数据库集群来保

如何在CakePHP中使用Memcached?如何在CakePHP中使用Memcached?Jun 04, 2023 am 08:14 AM

随着现代应用程序的快速增长,缓存已成为许多开发人员的至关重要的部分。缓存可以大大提高应用程序的性能并减少服务器负载。在CakePHP中,实现缓存的一种方法是使用Memcached。Memcached是一个基于内存的分布式缓存系统。它将数据存储在内存中,可以快速地读取和写入数据。在多服务器环境中,Memcached可以分布式存储数据并通过网络进行共享。不仅可以

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

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)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

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

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),