首頁  >  文章  >  後端開發  >  php-redis擴充安裝及其問題

php-redis擴充安裝及其問題

不言
不言原創
2018-04-28 14:40:141538瀏覽

這篇文章介紹的內容是關於php-redis擴充安裝及其問題,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下

先查看作業系統環境:

[root@jordy no-debug-non-zts-20170718]# cat /proc/version

Linux version 3.10.0-693.2.2.el7.x86_64 (builder@kbuilder. dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Sep 12 22:26:13 UTC 2017
[root@jordy no-bug- non-zts-20170718]# 
[root@jordy no-debug-non-zts-20170718]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1- noarch
Distributor ID: CentOS
#Description: CentOS Linux release 7.4.1708 (Core) 
Release: 7.4.1708

Codename: Core

php版本:

[root@jordy redis]# php -v
PHP 7.2.4 (cli ) (built: Apr 27 2018 18:08:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

redis版本:

[root@jordy redis]# redis-server  -v
Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-4.0.3 bits =64 build=c9d1038bab171720

#php-redis版本:

到php擴充官網(http://pecl.php.net/package/redis)搜尋redis擴充功能,然後查看相關版本支援情況:


Release 4.0.2: PHP Version: PHP version 7.9.99 or older
PHP Version: PHP 5.3.0 or newer
PEAR Package: PEAR 1.4.0b1 or newer

#選擇了php-redis 4.0.2版本:


安裝,四步走:

一./php/bin/phpize


二 ./configure --with-php-config=/usr/local/php7/bin/php-config

三make

#四make install


#安裝完畢後最終提示redis.so檔案已經產生在下面的目錄下面了

/opt/server/php/lib/php/extensions/no-debug -non-zts-20170718/

則開啟php的設定檔php.ini

然後增加增加extension=redis.so;

#中途安裝的時候,也許會報錯:

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.
說明確實autoconf庫;
然後直接yum 安裝該函式庫即可:

yum install -y autoconf

然後再按上面步驟搞起就好,^_^

##然後重啟php-fpm

然後查看phpinfo頁,查看已經ok:


#至於autoconf以及autoconf製作Makefile檔案的細節,我們以後再講

#^_^

相關推薦:

##php-redis擴充安裝(phpredis)

php-redis 的session作業

以上是php-redis擴充安裝及其問題的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn