PECL 的全稱是 The PHP Extension Community Library ,是一個開放的並通過 PEAR(PHP Extension and Application Repository,PHP 擴展和應用倉庫)打包格式來打包安裝的 PHP 擴展庫倉庫.
phpize 命令是用來準備 PHP 擴展庫的編譯環境的,有了這個工具不必為了一個想要的模塊,而重新編譯php了!
例子:為php增加openssl.so模塊
1 使用 phpize
- cd php-5.2.6/ext/openssl/
- /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519
- ./configure --with-openssl --with-php-config=/usr/local/php/bin/php-config
- make && make install
- installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
2 得到openssl.so 文件
- file /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/openssl.so
- /usr/.省略./openssl.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped
3 編輯php.in配置文檔
- 在php.ini內加入以下內容:
- extension_dir
= "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"- extension = "openssl.so"
4 重啟apache
- /usr/local/apache/bin/apachectl restart
5 驗證
- # /usr/local/php/bin/php -m | grep 'openssl'
- openssl
參考
http://www.php.net/manual/zh/install.pecl.intro.php
http://www.ibm.com/developerworks/cn/opensource/os-cn-php-pecl/index.html
結束
本文出自 「dongnan」 博客,請務必保留此出處http://dngood.blog.51cto.com/446195/813607
[火星人 ] PECL 與 phpize已經有235次圍觀