php擴充套件模組安裝
PECL 的全稱是 The PHP Extension Community Library ,是一個開放的並通過 PEAR(PHP Extension and Application Repository,PHP 擴充套件和應用倉庫)打包格式來打包安裝的 PHP擴充套件庫倉庫。通過 PEAR 的 Package Manager 的安裝管理方式,可以對 PECL 模組進行下載和安裝。
[root@chy ~]# cd /usr/local/src/
[root@chy src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
(首先下載一個develop包)
[root@chy src]# du -sh develop
220K develop
[root@chy src]# mv develop phpredis-develop.zip
(將這個develop改名字)
[root@chy src]# unzip phpredis-develop.zip
[root@chy src]# cd phpredis-develop
[root@chy phpredis-develop]#
[root@chy 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)
[root@chy phpredis-develop]# yum install -y autoconf
(安裝此包)
[root@chy phpredis-develop]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
(生成configure檔案)
[root@chy phpredis-develop]# ./configure --with-php-config=/usr/local/php/bin/php-config
(編譯)
[root@chy phpredis-develop]# echo $?
0
(成功)
[root@chy phpredis-develop]# make &&make install
[root@chy phpredis-develop]# ls /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
opcache.so redis.so
(redis.so這個是擴充套件模組)
[root@chy phpredis-develop]# /usr/local/php/bin/php -m |grep redis
(並沒有找到此模組)
[root@chy phpredis-develop]# /usr/local/php/bin/php -i |grep extension_dir
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
(檢視擴充套件模組存放目錄,我們可以在php.ini中去自定義該路徑)
[root@chy phpredis-develop]# vi /usr/local/php/etc/php.ini
;extension=php_shmop.dll
extension = redis.so
(增加extension = redis.so 這個可以在最後加也可以在;extension=php_shmop.dll這個的後面增加)
[root@chy phpredis-develop]# /usr/local/php/bin/php -m |grep redis
redis
(檢視已經增加了此模組)