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

Compile and install PHP extension redis under Linux

WBOY
Release: 2016-08-08 09:31:38
Original
1241 people have browsed it

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 客户端
Copy after login

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
Copy after login

Add to self-start

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

Install phpredis extension

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

Unzip:

tar zxvf phpredis-2.2.4.tar.gz
Copy after login

Enter the source code directory

cd phpredis-2.2.4
Copy after login

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

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

Compile and install

make && make install
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template