标签:php扩展模块
[toc]redis 在LAMP下,被当作缓存来使用!
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
/usr/local/php7/bin/phpize //生成configure文件
有时候安装会出错,缺少一个包autoconf
[root@xavi phpredis-develop]# yum install -y autoconf
重新生成configure
[root@xavi phpredis-develop]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
[root@xavi phpredis-develop]# ./configure --with-php-config=/usr/local/php7/bin/php-config
make
make install
ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
opcache.so redis.so
然后就会有redis.so这个插件!这就是我们需要的扩展模块
[root@xavi phpredis-develop]# make install
Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
[root@xavi phpredis-develop]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
opcache.so redis.so
[root@xavi phpredis-develop]# /usr/local/php7/bin/php -m
[PHP Modules]
bz2
Core
ctype
date
dom
exif
fileinfo
filter
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
不支持,找到模块路径
[root@xavi phpredis-develop]# /usr/local/php7/bin/php -m |grep redis
[root@xavi phpredis-develop]# /usr/local/php7/bin/php -i |grep extension_dir
extension_dir => /usr/local/php7/lib/php/extensions/no-debug-zts-20160303 => /usr/local/php7/lib/php/extensions/no-debug-zts-20160303
sqlite3.extension_dir => no value => no value
[root@xavi phpredis-develop]# vim /usr/local/php7/etc/php.ini
搜索 /extension
extension = redis.so
[root@xavi phpredis-develop]# vim /usr/local/php7/etc/php.ini
[root@xavi phpredis-develop]# /usr/local/php7/bin/php -m |grep redis
redis
实际上在php7的源码包中,有很多自带的源码包。我们不需要再次下载,直接编译即可!
[root@xavi phpredis-develop]# cd /usr/local/src/php-7.1.6/
[root@xavi php-7.1.6]# cd ext/
[root@xavi ext]# ls
bcmath fileinfo libxml pdo_firebird session tidy
bz2 filter mbstring pdo_mysql shmop tokenizer
calendar ftp mcrypt pdo_oci simplexml wddx
com_dotnet gd mysqli pdo_odbc skeleton xml
ctype gettext mysqlnd pdo_pgsql snmp xmlreader
curl gmp oci8 pdo_sqlite soap xmlrpc
date hash odbc pgsql sockets xmlwriter
dba iconv opcache phar spl xsl
dom imap openssl posix sqlite3 zip
enchant interbase pcntl pspell standard zlib
exif intl pcre readline sysvmsg
ext_skel json pdo recode sysvsem
ext_skel_win32.php ldap pdo_dblib reflection sysvshm
然后我们会发现有很多自带的源码包,
[root@xavi ext]# /usr/local/php7/bin/php -m |grep zip
[root@xavi ext]# cd zip/
[root@xavi zip]# ls
config.m4 CREDITS lib php_zip.c tests zip_stream.c
config.w32 examples LICENSE_libzip php_zip.h TODO
[root@xavi zip]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
[root@xavi zip]# ./configure --with-php-config=/usr/local/php7/bin/php-config
[root@xavi zip]# make install
Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
[root@xavi zip]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
opcache.so redis.so zip.so
部分转载来源:PHP扩展模块安装 - Laoqi‘s Blog
实用扩展:
apache rewrite教程 http://coffeelet.blog.163.com/blog/static/13515745320115842755199/
http://www.cnblogs.com/top5/archive/2009/08/12/1544098.html
apache rewrite 出现死循环 http://ask.apelearn.com/question/1043
php错误日志级别参考 http://ask.apelearn.com/question/6973
php开启短标签 http://ask.apelearn.com/question/120
php.ini详解 http://legolas.blog.51cto.com/2682485/493917
标签:php扩展模块
原文地址:http://blog.51cto.com/12995218/2085338