PHP新增zip&&curl擴充套件

luobin77發表於2016-06-23

LAMP環境編譯安裝,其中php版本為5.6.8,php-fpm已經做成了系統服務,OS版本為CentOS6.x系列

[RuntimeException]                                                        
  The Zip PHP extension is not installed. Please install it and try again.

安裝php,zip模組

cd /usr/local/src
wget http://pecl.php.net/get/zip-1.12.4.tgz
tar xvf zip-1.12.4.tgz -C /usr/local/
cd /usr/local/zip-1.12.4
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
安裝完成後會在/usr/local/php/lib/php/extensions/下生成no-debug-non-zts-xxxxxxxx的目錄,其中包含了zip.so
vim /etc/php.ini或者vim /usr/local/php/etc/php.ini
新增一行
extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/zip.so
重新載入或重啟fpm
service php-fpm restart

其他zip版本可檢視以下連線
http://pecl.php.net/package/zip

新增curl擴充套件

cd /usr/local/src/php-5.6.8/ext/curl
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
echo "extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so" >>/etc/php.ini
service php-fpm restart
/usr/local/php/bin/php -m | grep curl


相關文章