How to install extended redis in php under linux

藏色散人
Release: 2023-03-02 14:34:02
Original
2308 people have browsed it

How to install extensions in PHP under Linux: first install the compilation tool; then download the "phpredis" extension and complete the installation; then add "extension="redis.so""; finally open "index.php" in the browser That’s it.

How to install extended redis in php under linux

Instructions:

操作系统:CentOS php安装目录:/usr/local/php php.ini配置文件路径:/usr/local/php/etc/php.ini Nginx安装目录:/usr/local/nginx Nginx网站根目录:/usr/local/nginx/html
Copy after login

1. Install the compilation tool

yum install wget make gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel kernel keyutils patch perl
Copy after login

2. Install redis

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

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

cd /usr/local/src #进入软件包存放目录 tar zxvf phpredis-2.2.4.tar.gz #解压 cd phpredis-2.2.4 #进入安装目录 /usr/local/php/bin/phpize #用phpize生成configure配置文件 ./configure --with-php-config=/usr/local/php/bin/php-config #配置 make #编译 make install #安装
Copy after login

After the installation is completed, the following installation path appears

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

3. Configure php support

vi /usr/local/php/etc/php.ini #Edit the configuration file at the end Add the following content in one line

Add

extension="redis.so" :wq! #保存退出
Copy after login

4. Test

vi /usr/local/nginx/html/index.php #编辑  :wq! #保存退出
Copy after login

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

How to install extended redis in php under linux

At this point, the PHP redis installation under Linux is completed!

For more related knowledge, please visitPHP Chinese website!

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

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!