Home >Database >Redis >How to install redis extension in PHP under Linux

How to install redis extension in PHP under Linux

PHPz
PHPzforward
2023-05-29 14:01:331528browse

Description:

Operating system: CentOS

php installation directory:/usr/local/php

php.ini configuration file path:/usr/local/php /etc/php.ini

Nginx installation directory:/usr/local/nginx

Nginx website root directory:/usr/local/nginx/html

linux php installation Specific steps for redis extension

1. Install the compilation tool

yum install wget make gcc gcc-c zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch perl

2 , Install redis

Download: https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

Upload phpredis-2.2.4.tar.gz to / usr/local/src directory

cd /usr/local/src #Enter the software package storage directory

tar zxvf phpredis-2.2.4.tar.gz #Unzip

cd phpredis-2.2.4 #Enter the installation directory

/usr/local/php/bin/phpize #Use phpize to generate the configure configuration file

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

make #Compile

make install #Installation

After the installation is completed, the following installation path appears

/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

3. Configure php support

vi /usr/local/ php/etc/php.ini #Edit the configuration file and add the following content in the last line

Add

extension="redis.so"

:wq! #Save and exit

4. Test

vi /usr/local/nginx/html/index.php #Edit

phpinfo();

?>

:wq! #Save and exit

Open index.php in the browser, as shown below, you can see redis related information

How to install redis extension in PHP under Linux

The above is the detailed content of How to install redis extension in PHP under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete