
一、windows安裝php擴充功能
#1.下載
http://pecl.php.net/是官方的擴充庫,我們可以在這裡下載自想要的擴充功能。

相關推薦:《PHP入門教學》
2.選擇版本
已安裝redis為例:


點選
按鈕後進入windows下載介面

##安裝windows的php擴充功能需要注意版本的選擇:php的版本、是否是線性安全性、作業系統的位元數。
3.安裝
將下載好的壓縮包解壓縮,然後把裡面的php_redis.dll放到php.ini中製定的資料夾裡面,並把redis模組加載,然後重啟伺服器.

二、linux安裝php擴充功能
#1.yum或apt-get安裝

2.使用pecl安裝
1)、pecl install安裝
~# pecl install memcached
downloading memcached-2.2.0.tgz .. .
Starting to download memcached-2.2.0.tgz (70,449 bytes)....
2)、設定php.ini
#透過執行php --ini尋找php.ini檔案位置,然後在檔案中加入extension=memcached.so
3.phpize安裝-以redis為例
1)、下載php擴充包
#[root@localhost ~]# wget http://pecl.php.net/get/redis-4.0.0.tgz
2)、解壓縮並進入擴充包目錄
[root@localhost ~]# tar -xzvvf redis-4.0.0.tgz
[root@localhost redis-4.0.0]# cd redis-4.0.0
#3)、執行phpize
[root@localhost redis-4.0.0]# phpize
4)、./configure
[root@localhost redis-4.0.0]# . /configure --with-php-config=/usr/bin/php-config
5)、make && make install
[root@localhost redis-4.0.0]# make && make install
6)、設定php.ini
extension=redis.so
4.直接安裝(類似windows)
直接下載將下載好的壓縮包,解壓縮後將.so後綴的檔案直接放到指定的路徑,然後配置php.ini檔。
以上是如何安裝php擴充的詳細內容。更多資訊請關注PHP中文網其他相關文章!