php編譯後動態擴展模塊
阿新 • • 發佈:2018-03-05
php編譯後動態擴展模塊不需要重新編譯php,可以動態擴展php模塊
這裏以擴展mysqli為例:
1.安裝phpize需要的依賴包
# yum install m4 autoconf
2.生成編譯mysqli的configure
進入PHP源碼目錄中擴展模塊目錄ext
# cd /app/httpd/php-5.6.34/ext/mysqli
#/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
3.查下當前PHP的擴展目錄
# /usr/local/php/bin/php-config --extension-dir
/usr/local/php-5.6.34/lib/php/extensions/no-debug-non-zts-20131226
4.編譯mysqli
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config #make && make install clean Installing shared extensions: /usr/local/php-5.6.34/lib/php/extensions/no-debug-non-zts-20131226/ Installing header files: /usr/local/php-5.6.34/include/php/
5.檢查
#ll /usr/local/php-5.6.34/lib/php/extensions/no-debug-non-zts-20131226/
-rwxr-xr-x 1 root root 715322 Mar 5 16:11 mysqli.so
6.添加啟用mysqli
#vim /etc/php.ini
找到[MySQLi]配置塊
添加
extension=mysqli.so
7.重啟php
php編譯後動態擴展模塊