Linux下编译redis和phpredis的方法,redisphpredis
Linux下编译redis和phpredis的方法,redisphpredis
本文讲述了Linux下编译redis和phpredis的方法。分享给大家供大家参考,具体如下:
1、准备工作
下载软件:本站下载地址。
操作系统:CentOS 5.5
redis 版本:redis-2.6.9
2、编译安装
tar zxvf redis-2.6.9.tar.gz //解压 cd redis-2.6.9 make //编译
如果出现如下错误:
zmalloc.o: In function `zmalloc_used_memory':
/data/redis-2.6.9/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/data/redis-2.6.9/src'
make: *** [all] Error 2
解决方法:
make CFLAGS="-march=i686"
当看见“Hint: To run 'make test' is a good idea ;)” 说明编译成功。
make install //安装
说明:其实 make install 就是:
cp -p redis-server /usr/local/bin cp -p redis-benchmark /usr/local/bin cp -p redis-cli /usr/local/bin cp -p redis-check-dump /usr/local/bin cp -p redis-check-aof /usr/local/bin
这样,redis 就安装成功了。
接下来就是启动Redis了, 上面编译后生成的那些可执行文件拷贝到了/usr/local/bin目录下面, 他们的作用分别是:
redis-server:Redis服务器的daemon启动程序
redis-cli:Redis命令行操作工具。当然,你也可以用 telnet 根据其纯文本协议来操作
redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
启动 Redis 进程只需要执行这个 /usr/local/bin/redis-server /path-to/redis.conf
启动的时候后面要跟上 redis 的配置文件, 这样Redis就顺利启动了.
3、启动 redis 会出现的问题
Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
解决方法:修改配置文件 redis.conf 将 maxmemory 设置为 maxmemory 1024000000 #分配256M内存
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
解决方法:警告:过量使用内存设置为0!在低内存环境下,后台保存可能失败。为了修正这个问题,请在/etc/sysctl.conf 添加一项 'vm.overcommit_memory = 1' ,然后重启(或者运行命令'sysctl vm.overcommit_memory=1' )使其生效。
当启动的时候没有任何信息,表明启动成功。也可以使用 "netstat -tnl" 查看6379端口是否启动。
4、开启和关闭 redis
redis-server /usr/local/redis-2.6.9/redis.conf 开启,注:需要指定 redis 的配置文件
pkill redis-server 停止 redis
redis-cli shutdown 停止 redis
5、redis.conf 的参数信息
关于redis及其参数信息可参考本站《Redis基本知识、安装、部署、配置笔记》
6、编译 phpredis
unzip phpredis-master.zip cd phpredis-master /usr/local/php/bin/phpize ./configure –with-php-config=/usr/local/php/bin/php-config make && make install
修改 php.ini 文件。加载 redis.so 模块,重启 Apache !
更多关于PHP相关内容感兴趣的读者可查看本站专题:《php curl用法总结》、《PHP运算与运算符用法总结》、《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《php操作office文档技巧总结(包括word,excel,access,ppt)》、《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家PHP程序设计有所帮助。
您可能感兴趣的文章:
- Linux下Redis的安装和部署
- Linux下安装Redis并设置相关服务
- CentOS Linux系统下安装Redis过程和配置参数说明
- Linux(CentOS)下PHP扩展PDO编译安装的方法
- linux下为php添加iconv模块的方法
- PHP执行linux命令常用函数汇总
- Linux安装配置php环境的方法
- Linux系统中设置多版本PHP共存配合Nginx服务器使用
- Linux系统下PHP-FPM的安装和配置教程

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

DeepSeek is a powerful intelligent search and analysis tool that provides two access methods: web version and official website. The web version is convenient and efficient, and can be used without installation; the official website provides comprehensive product information, download resources and support services. Whether individuals or corporate users, they can easily obtain and analyze massive data through DeepSeek to improve work efficiency, assist decision-making and promote innovation.

There are many ways to install DeepSeek, including: compile from source (for experienced developers) using precompiled packages (for Windows users) using Docker containers (for most convenient, no need to worry about compatibility) No matter which method you choose, Please read the official documents carefully and prepare them fully to avoid unnecessary trouble.

BITGet is a cryptocurrency exchange that provides a variety of trading services including spot trading, contract trading and derivatives. Founded in 2018, the exchange is headquartered in Singapore and is committed to providing users with a safe and reliable trading platform. BITGet offers a variety of trading pairs, including BTC/USDT, ETH/USDT and XRP/USDT. Additionally, the exchange has a reputation for security and liquidity and offers a variety of features such as premium order types, leveraged trading and 24/7 customer support.

Ouyi OKX, the world's leading digital asset exchange, has now launched an official installation package to provide a safe and convenient trading experience. The OKX installation package of Ouyi does not need to be accessed through a browser. It can directly install independent applications on the device, creating a stable and efficient trading platform for users. The installation process is simple and easy to understand. Users only need to download the latest version of the installation package and follow the prompts to complete the installation step by step.

Gate.io is a popular cryptocurrency exchange that users can use by downloading its installation package and installing it on their devices. The steps to obtain the installation package are as follows: Visit the official website of Gate.io, click "Download", select the corresponding operating system (Windows, Mac or Linux), and download the installation package to your computer. It is recommended to temporarily disable antivirus software or firewall during installation to ensure smooth installation. After completion, the user needs to create a Gate.io account to start using it.

Ouyi, also known as OKX, is a world-leading cryptocurrency trading platform. The article provides a download portal for Ouyi's official installation package, which facilitates users to install Ouyi client on different devices. This installation package supports Windows, Mac, Android and iOS systems. Users can choose the corresponding version to download according to their device type. After the installation is completed, users can register or log in to the Ouyi account, start trading cryptocurrencies and enjoy other services provided by the platform.

Gate.io is a highly acclaimed cryptocurrency trading platform known for its extensive token selection, low transaction fees and a user-friendly interface. With its advanced security features and excellent customer service, Gate.io provides traders with a reliable and convenient cryptocurrency trading environment. If you want to join Gate.io, please click the link provided to download the official registration installation package to start your cryptocurrency trading journey.

Nexo Exchange: Swiss cryptocurrency lending platform In-depth analysis Nexo is a platform that provides cryptocurrency lending services, supporting the mortgage and lending of more than 40 crypto assets, fiat currencies and stablecoins. It dominates the European and American markets and is committed to improving the efficiency, security and compliance of the platform. Many investors want to know where the Nexo exchange is registered, and the answer is: Switzerland. Nexo was founded in 2018 by Swiss fintech company Credissimo. Nexo Exchange Geographical Location and Regulation: Nexo is headquartered in Zug, Switzerland, a well-known cryptocurrency-friendly region. The platform actively cooperates with the supervision of various governments and has been in the US Financial Crime Law Enforcement Network (FinCEN) and Canadian Finance
