Home >Backend Development >PHP Tutorial >Compile and install PHP extension redis under Linux

Compile and install PHP extension redis under Linux

WBOY
WBOYOriginal
2016-08-08 09:31:381236browse

The Linux environment is CentOS6.5 64-bit

Installing redis is relatively simple, there is nothing to say, just look at the official website, link: http://redis.io/download mainly look at the bottom.

After installing redis, copy the two commands in the generated directory src to /bin for easy calling

cp /var/soft/redis-2.8.19/src/redis-server /bin/redis-server  redis 服务
cp /var/soft/redis-2.8.19/src/redis-cli /bin/redis-cli        redis 客户端

Note: /var/soft/redis-2.8.19 is the directory where my redis software source code is located

Start redis service

redis-server /var/soft/redis-2.8.19/redis.conf

Add to self-start

echo "redis-server /var/soft/redis-2.8.19/redis.conf" >> /etc/rc.d/rc.local

Install phpredis extension

Download address: http://pan.baidu.com/s/1nt3dfuT

Unzip:

tar zxvf phpredis-2.2.4.tar.gz

Enter the source code directory

cd phpredis-2.2.4

Use phpize to generate configure files (phpize is in the php installation directory/bin)

phpize
Configuration
./configure --with-php-config=/usr/local/php/bin/php-config

Compile and install

make && make install

After success, the directory where redis.so appears

Open php.ini and add extension=xxxx/redis.so

Save and restart apache/nginx.

The above introduces the compilation and installation of the PHP extension redis under Linux, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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
Previous article:PHP中$this,$self,$parentNext article:PHP中$this,$self,$parent