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详解

相关文章
相关标签/搜索