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
yum install wget make gcc gcc-c zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch perl
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/
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
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
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!