Redis is the remote dictionary service. It is an open source log-type Key-Value database written in ANSI C language, supports the network, can be memory-based and persistent, and provides APIs in multiple languages.
1. Download the source code, decompress it and compile the source code.
wget http://download.redis.io/releases/redis-4.0.2.tar.gz tar xzf redis-4.0.2.tar.gz cd xzf redis-4.0.2 make
2. After compilation is completed, there are four executable files redis-server, redis-benchmark, redis-cli and redis.conf in the Src directory. Then copy it to a directory. (redis.conf may also be in the upper layer)
mkdir /usr/redis cp redis-server /usr/redis cp redis-benchmark /usr/redis cp redis-cli /usr/redis cp redis.conf /usr/redis cd /usr/redis
3. Start the Redis service.
./redis-server // ./redis-server & 后台运行
4. Then use the client to test whether the startup is successful.
$ redis-cli redis> set foo bar OK redis> get foo "bar"
Install redis extension
Download: https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
Supplement:
phpredis extension download address:
<a href="https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxcheckurl?requrl=https%3A%2F%2Fgithub.com%2Fphpredis%2Fphpredis%2Farchive%2Fdevelop.zip&skey=%40crypt_4f202e30_6b2e50deafd322d9820dc0babc08935e&deviceid=e090189265878664&pass_ticket=3HpM538HybnH5DP2QwHWMhZNdF0vPv6uHPr2IznqqzvtpYh0CuYPCEhOCuivsCLT&opcode=2&scene=1&username=@351cedf05d7cbf94d9732b481f0dba13ed94dc5a13b422c905cca85ae2a54ec3" rel="nofollow" style="background:transparent;color:rgb(202,12,22);">https://github.com/phpredis/phpredis/archive/develop.zip</a>
If the above one does not work, use the following address (the test environment of the following address is: php7.1 redis 4.0.2)
Other steps are the same
Upload phpredis-2.2.4.tar.gz to the /usr/local/src directory
cd /usr/local/src #进入软件包存放目录 tar zxvf phpredis-2.2.4.tar.gz #解压 cd phpredis-2.2.4 #进入安装目录 /usr/local/php/bin/phpize #用phpize生成configure配置文件 ./configure --with-php-config=/usr/local/php/bin/php-config #配置 make #编译 make install #安装
After the installation is completed, the following installation path appears
/usr/local/ php/lib/php/extensions/no-debug-non-zts-20090626/
2. Configure php support
vi /usr/local/php/etc/php.ini #Edit Configuration file, add the following content in the last line
Add
extension="redis.so"
:wq! #Save and exit
3. Restart Service
service php-fpm restart
For more redis knowledge, please pay attention to the PHP Chinese websiteredis tutorial column.
The above is the detailed content of Installation of redis and redis extensions on Linux platform. For more information, please follow other related articles on the PHP Chinese website!

Redis goes beyond SQL databases because of its high performance and flexibility. 1) Redis achieves extremely fast read and write speed through memory storage. 2) It supports a variety of data structures, such as lists and collections, suitable for complex data processing. 3) Single-threaded model simplifies development, but high concurrency may become a bottleneck.

Redis is superior to traditional databases in high concurrency and low latency scenarios, but is not suitable for complex queries and transaction processing. 1.Redis uses memory storage, fast read and write speed, suitable for high concurrency and low latency requirements. 2. Traditional databases are based on disk, support complex queries and transaction processing, and have strong data consistency and persistence. 3. Redis is suitable as a supplement or substitute for traditional databases, but it needs to be selected according to specific business needs.

Redisisahigh-performancein-memorydatastructurestorethatexcelsinspeedandversatility.1)Itsupportsvariousdatastructureslikestrings,lists,andsets.2)Redisisanin-memorydatabasewithpersistenceoptions,ensuringfastperformanceanddatasafety.3)Itoffersatomicoper

Redis is primarily a database, but it is more than just a database. 1. As a database, Redis supports persistence and is suitable for high-performance needs. 2. As a cache, Redis improves application response speed. 3. As a message broker, Redis supports publish-subscribe mode, suitable for real-time communication.

Redisisamultifacetedtoolthatservesasadatabase,server,andmore.Itfunctionsasanin-memorydatastructurestore,supportsvariousdatastructures,andcanbeusedasacache,messagebroker,sessionstorage,andfordistributedlocking.

Redisisanopen-source,in-memorydatastructurestoreusedasadatabase,cache,andmessagebroker,excellinginspeedandversatility.Itiswidelyusedforcaching,real-timeanalytics,sessionmanagement,andleaderboardsduetoitssupportforvariousdatastructuresandfastdataacces

Redis is an open source memory data structure storage used as a database, cache and message broker, suitable for scenarios where fast response and high concurrency are required. 1.Redis uses memory to store data and provides microsecond read and write speed. 2. It supports a variety of data structures, such as strings, lists, collections, etc. 3. Redis realizes data persistence through RDB and AOF mechanisms. 4. Use single-threaded model and multiplexing technology to handle requests efficiently. 5. Performance optimization strategies include LRU algorithm and cluster mode.

Redis's functions mainly include cache, session management and other functions: 1) The cache function stores data through memory to improve reading speed, and is suitable for high-frequency access scenarios such as e-commerce websites; 2) The session management function shares session data in a distributed system and automatically cleans it through an expiration time mechanism; 3) Other functions such as publish-subscribe mode, distributed locks and counters, suitable for real-time message push and multi-threaded systems and other scenarios.


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

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

Hot Article

Hot Tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools

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),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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