PHP動態擴展模塊安裝

PHP動態擴展模塊安裝

  • 如今咱們的php已經安裝好了,這個時候呢咱們發現缺乏某個模塊,咱們總不能去從新編譯php吧。因此呢本文主要講解用動態擴展模塊來安裝PHP模塊
  • 查看php 都加載了那些模塊
/usr/local/php/bin/php -m

安裝一個php的redis擴展模塊

1.下載源碼包並解壓php

#進入下載目錄下
[root@centos001 ~]# cd /usr/local/src/
#下載
[root@centos001 src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
#更名
[root@centos001 src]# mv develop phpredis-develop.zip
#解壓
[root@centos001 src]# unzip phpredis-develop.zip
#進入文件目錄下
[root@centos001 src]# cd phpredis-develop
  • 錯誤:生成configure文件報錯
[root@centos001 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.

2.安裝yum包,後再次生成文件html

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

3.配置編譯參數git

[root@centos001 phpredis-develop]# ./configure --with-php-config=/usr/local/php/bin/php-config
[root@centos001 phpredis-develop]# echo $?
0

4.編譯安裝github

[root@centos001 phpredis-develop]# make && make install
[root@centos001 phpredis-develop]# echo $?
0

5.查看擴展模塊存放目錄redis

[root@centos001 phpredis-develop]# /usr/local/php/bin/php -i |grep extension_dir
 #下面這一大串是個警告,當按照視屏中設置php7目錄的時候就沒有出現.若是要去掉它,能夠在php.ini裏設置一下timezone那個參數
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

6.修改配置文件sql

#能夠看到redis.so,可是這裏是沒有加載的
[root@centos001 phpredis-develop]# ls /usr/local/php/lib/php/extensions/no-debug-zts-20131226
opcache.so  redis.so
#進入配置文件
#添加以下到模塊下
extension = redis.so

7.檢查是否加載了模塊apache

[root@centos001 phpredis-develop]# vim /usr/local/php/etc/php.ini 
[root@centos001 phpredis-develop]# /usr/local/php/bin/php -m |grep redis
redis

擴展

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/493917vim

相關文章
相關標籤/搜索