search
HomeBackend DevelopmentPHP TutorialTencent CMEM PHP extension compilation and installation method_php skills

The example in this article describes the compilation and installation method of PHP extension of Tencent CMEM. Share it with everyone for your reference. The details are as follows:

What is CMEM?

CMEM, the full name of Cloud Memory, is a high-performance memory-level persistent storage service provided by Tencent. It is suitable for scenarios with small data volume, high access volume, and key-value storage.

CMEM is based on a hashmap that stores key/value pairs. Data is stored in memory and ensures data persistence.

What is CMEM PHP Extension?

CMEM is based on the standard Memcached protocol and interface, but only adds return value settings to the data acquisition interface.
Memcached's Get protocol does not have a return code designed, so when the Memcached API returns NO_DATA, it may be caused by network reasons and cannot be fully trusted. Using the following process will be very dangerous and will cause user data to be initialized:

if(NO_DATA) {
  InitData();
}

To solve the above problems, CMEM provides the Memcahced text extension protocol, adding two extended commands get_ext and gets_ext, so that the client can determine whether the data exists based on the return code. This can avoid incorrect initialization of user data due to failure to obtain data when network and device failures occur.

CMEM compilation and installation

# 下载CMEM
cd /home/src
wget http://cmem.googlecode.com/files/cmem-2.2.6.tar.gz
# 解压
tar zxvf cmem-2.2.6.tar.gz
cd cmem-2.2.6
# 编译
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
# 安装PHP扩展
cp modules/cmem.so /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/
# 配置php.ini
# 加入以下内容
# --------------------------------------------------
extension = "cmem.so"
# --------------------------------------------------
# 测试
# 新建cmemtest.php
cat > /tmp/cmemtest.php
# 代码为
# --------------------------------------------------
<&#63;php
if(!class_exists('CMEM')) echo "CMEM NOT FOUND!\n";
else echo "CMEM IS OK\n";
&#63;>
# --------------------------------------------------
# 执行测试文件
/usr/local/webserver/php/bin/php -f /tmp/cmemtest.php

I hope this article will be helpful to everyone’s PHP programming design.

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
如何查看php用了哪些扩展如何查看php用了哪些扩展Aug 01, 2023 pm 04:13 PM

查看phpinfo()函数输出、使用命令行工具和检查PHP配置文件均可以查看php用了哪些扩展。1、查看phpinfo()函数输出,创建一个简单的PHP脚本,将这个脚本保存为phpinfo.php,并将其上传到您的Web服务器,在浏览器中访问此文件,使用浏览器的搜索功能,在页面中查找关键字"extension"或"extension_loaded",以找到有关扩展的信息即可。

如何使用PHP扩展SuiteCRM的报告生成功能如何使用PHP扩展SuiteCRM的报告生成功能Jul 19, 2023 am 10:27 AM

如何使用PHP扩展SuiteCRM的报告生成功能SuiteCRM是一款功能强大的开源CRM系统,它提供了丰富的功能来帮助企业管理客户关系。其中一个重要的功能就是报告生成,使用报告可以帮助企业更好地了解业务情况,并作出正确的决策。本文将介绍如何使用PHP扩展SuiteCRM的报告生成功能,并提供相关的代码示例。在开始之前,需要确保已经安装好了SuiteCRM,

如何使用php扩展PDO连接Oracle数据库如何使用php扩展PDO连接Oracle数据库Jul 29, 2023 pm 07:21 PM

如何使用PHP扩展PDO连接Oracle数据库导语:PHP是一种非常流行的服务器端编程语言,而Oracle是一款常用的关系型数据库管理系统。本文将介绍如何使用PHP扩展PDO(PHPDataObjects)来连接Oracle数据库。一、安装PDO_OCI扩展要连接Oracle数据库,首先需要安装PDO_OCI扩展。以下是安装PDO_OCI扩展的步骤:确保

PHP入门指南:PHP扩展安装PHP入门指南:PHP扩展安装May 20, 2023 am 08:49 AM

在使用PHP进行开发时,我们可能需要使用一些PHP扩展。这些扩展可以为我们提供更多的功能和工具,使我们的开发工作更加高效和便捷。但在使用这些扩展之前,我们需要先进行安装。本篇文章将为您介绍PHP扩展的安装方法。一、什么是PHP扩展?PHP扩展是指为PHP编程语言提供额外功能和服务的组件。这些组件可以通过PHP的扩展机制进行安装和使用。PHP扩展可以帮助我们处

php如何使用PHP的geoip扩展?php如何使用PHP的geoip扩展?Jun 01, 2023 am 09:13 AM

PHP是一种流行的服务器端脚本语言,它可以处理网页上的动态内容。PHP的geoip扩展可以让你在PHP中获取有关用户位置的信息。在本文中,我们将介绍如何使用PHP的geoip扩展。什么是PHP的GeoIP扩展?PHP的geoip扩展是一个免费的、开源的扩展,它允许你获取有关IP地址和位置信息的数据。该扩展可以与GeoIP数据库一起使用,这是一个由MaxMin

宝塔面板的PHP扩展和PHP版本管理宝塔面板的PHP扩展和PHP版本管理Jun 21, 2023 am 08:49 AM

宝塔面板是一款开源的服务器管理面板,在为网站运营者提供便捷的网站管理、数据库管理、SSL证书管理等服务的同时,还提供了强大的PHP扩展和PHP版本管理功能,让服务器管理变得更加简单和高效。一、PHP扩展PHP扩展是一种用来增强PHP功能的模块,通过安装PHP扩展可以实现更多的功能和服务,比如:加速器:加速器可以显著地提高PHP性能,通过缓存PHP脚本,减轻服

教程:使用极光推送及其PHP扩展在应用中添加消息推送功能教程:使用极光推送及其PHP扩展在应用中添加消息推送功能Jul 26, 2023 am 08:07 AM

教程:使用极光推送及其PHP扩展在应用中添加消息推送功能引言:在如今的移动应用开发中,消息推送功能已经成为了各类应用必不可少的一部分。而极光推送则是这方面最常用、最受开发者欢迎的解决方案之一。本教程将介绍如何使用极光推送及其PHP扩展来在应用中添加消息推送功能,并提供相应的代码示例供参考。一、极光推送简介极光推送是一款基于云服务的、跨平台的消息推送解决方案。

完全指南:如何使用php扩展SimpleXML读取和处理XML数据完全指南:如何使用php扩展SimpleXML读取和处理XML数据Jul 28, 2023 pm 02:46 PM

完全指南:如何使用PHP扩展SimpleXML读取和处理XML数据简介:在现代的Web开发中,处理和操作XML数据是一项非常常见的任务。PHP作为一种强大的服务器端脚本语言,提供了多种扩展和功能,用于处理和操作XML数据。其中,SimpleXML扩展是一种特别有用的工具,可以简化XML数据的读取和处理过程。本文将为您提供一个完整的指南,介绍如何使用PHP扩展

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

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

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

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version