Home >Backend Development >PHP Problem >How to install redis extension in php5.3

How to install redis extension in php5.3

王林
王林Original
2021-02-22 15:46:303237browse

php5.3 How to install the redis extension: 1. Download and decompress the redis driver; 2. Use the phpize command to compile; 3. Use the [make install] command to install; 4. Restart PHP.

How to install redis extension in php5.3

The operating environment of this article: red hat enterprise linux 7.4 system, php 5.3&&redis 4.0, thinkpad t480 computer.

The specific method is as follows:

First make sure that we have installed the redis service and that php can be used normally on the machine.

Then download and install the redis driver

cd /opt
wget https://github.com/phpredis/phpredis/releases/tag/5.3.0RC2
tar -zxvf 5.3.0RC2
cd phpredis-5.3.0RC2
phpize
./configure --with-php-config=/usr/bin/php-config
make
make install

Then edit the configuration file

I choose to add extension=redis.so.

## directly to the php.ini file. #But when I added it, the following error occurred:

PHP Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib64/php/modules/redis.so (/usr/lib64/php/modules/redis.so: .....................

Do not add the line extension=redis.so to php.ini. You can find it in the php.d (where is php.d) folder. Create a new file redis.ini and add the line extension=redis.so to redis.ini.

Finally restart php

php -m and find that the redis extension is loaded.

Related recommendations:

php tutorial

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

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