LAMP架構(PHP擴展模塊安裝)

php動態擴展模塊安裝之redis

php專用擴展區php

查看模塊html

/usr/local/php/bin/php -m

安裝一個redis模塊git

1.下載php的redis模塊到/usr/local/src/目錄下github

cd /usr/local/src/
wget https://codeload.github.com/phpredis/phpredis/zip/develop //獲取下載

2.修改下載的文件名稱redis

mv develop phpredis-develop.zip

3.解壓sql

unzip phpredis-develop.zip

4.生成configure文件apache

/usr/local/php/bin/phpize
[root@yolks2 phpredis-develop]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

報錯提示找不到autoconf,yum安裝一下便可:vim

yum install -y autoconf

再次嘗試已經能夠php7

[root@yolks2 phpredis-develop]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226

5.進行編譯ide

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

查看編譯結果:$?查看返回是否等於0

[root@yolks2 phpredis-develop]# echo $?
0

6.編譯安裝

make && make install

7.查看安裝的擴展模塊

[root@yolks2 phpredis-develop]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
opcache.so  redis.so

8.查看擴展模塊存放目錄,咱們能夠在php.ini中去自定義該路徑

[root@yolks2 phpredis-develop]# /usr/local/php/bin/php -i |grep extension_dir
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
extension_dir => /usr/local/php/lib/php/extensions/no-debug-zts-20131226 => /usr/local/php/lib/php/extensions/no-debug-zts-20131226
sqlite3.extension_dir => no value => no value

9.編輯php配置文件

vim /usr/local/php/etc/php.ini

10.查詢如下redis模塊是否加載

[root@yolks2 phpredis-develop]# /usr/local/php7/bin/php -m |grep redis
redis

拓展

apache rewrite(一)教程
apache rewrite(二)教程
apache rewrite 出現死循環
php錯誤日誌級別參考
php開啓短標籤
php.ini詳解

相關文章
相關標籤/搜索