标签:Linux学习
11.32 PHP扩展模块安装PHP动态扩展模块
/usr/local/php/bin/php -m //查看模块
下面安装一个redis模块
cd /usr/local/src/
wget https://codeload.github.com/phpredis/phpredis/zip/develop
mv develop phpredis-develop.zip
unzip phpredis-develop.zip
cd phpredis-develop
yum install -y autoconf
/usr/local/php/bin/phpize //生成configure文件
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
/usr/local/php/bin/php -i |grep extension_dir //查看扩展模块存放目录,我们可以在 php.ini 中去自定义该路径,默认模块路径不需要修改
vim /usr/local/php/etc/php.ini //增加一行配置(可以放到文件最后一行)
extension=redis.so
操作过程
[root@linux-01 ~]# /usr/local/php/bin/php -m
查看无Redis模块
[root@linux-01 ~]# cd /usr/local/src/
[root@linux-01 src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
[root@linux-01 src]# mv develop phpredis-develop.zip
[root@linux-01 src]# unzip phpredis-develop.zip
[root@linux-01 src]# cd phpredis-develop/
[root@linux-01 phpredis-develop]# /usr/local/php/bin/phpize
[root@linux-01 phpredis-develop]# /usr/local/php/bin/phpize
[root@linux-01 phpredis-develop]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@linux-01 phpredis-develop]# make
[root@linux-01 phpredis-develop]# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
[root@linux-01 phpredis-develop]# ls /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
opcache.so redis.so
[root@linux-01 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
[root@linux-01 phpredis-develop]# vim /usr/local/php/etc/php.ini
在 ;extension=php_shmop.dll 下面添加
extension=redis.so
[root@linux-01 phpredis-develop]# /usr/local/php/bin/php -m |grep redis
redis
标签:Linux学习
原文地址:http://blog.51cto.com/9298822/2105514