一,phpize的好處php
何時咱們要用phpize呢?咱們在安裝php時:python
./configure --prefix=/apps/product/php --with-config-file-path=/apps/product/php/etc \ --with-iconv-dir --with-freetype-dir --with-png-dir --with-zlib --with-libxml-dir=/usr \ --enable-xml --enable-discard-path --enable-safe-mode --enable-bcmath \ --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl \ --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm \
後面根的參數是咱們要的模塊,可是隨着工做的須要,咱們還要在加些模塊,又不想從新編譯php,這些咱們就能夠用phpize了。vim
二,安裝php模塊php7
下面我以gd模塊安裝爲例子:app
cd /apps/product/php-5.6.10/ext/gd #ext目錄下面放的是php的模塊庫 /apps/product/php5/bin/phpize #肯定php-config文件是否存在,調用php-config,安裝後.so文件會自動放到extension_dir裏面 ./configure --enable-gd --with-php-config=/apps/product/php5/bin/php-config make && make install
安裝完後會有這樣的東西curl
See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'. Installing shared extensions: /app/product/php5/lib/php/extensions/no-debug-non-zts-20060613/
三,查看.so文件,以及修改php.ini測試
cd /app/product/php5/lib/php/extensions/no-debug-non-zts-20060613/ ls -al |grep gd -rwxr-xr-x 1 root root 763334 Feb 9 10:51 gd.so vi /app/product/php5/lib/php.ini 在加載模塊的地加上一行extension=gd.so
四,重起phpf服務ui
查看編譯的模塊:url
/apps/product/php5/bin/php -i|grep configure /apps/product/php5/bin/php -m
php 開啓openssl擴展:(當時沒測試成功,只能從新編譯安裝了)spa
#進入源碼目錄: cd /usr/local/src/php-7.0.14/ext/openssl [root@supplier-pre01 openssl]# /usr/local/php7/bin/phpize Cannot find config.m4. Make sure that you run '/usr/local/php7/bin/phpize' in the top level source directory of the module [root@supplier-pre01 openssl]# [root@supplier-pre01 openssl]# mv config0.m4 config.m4 [root@supplier-pre01 openssl]# /usr/local/php7/bin/phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No: 320151012 [root@supplier-pre01 openssl]# [root@supplier-pre01 openssl]# ./configure --with-openssl --with-php-config=/usr/local/php7/bin/php-config checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for a sed that does not truncate output... /bin/sed checking for cc... cc checking for C compiler default output file name... a.out checking whether the C compiler works... yes ...... creating libtool appending configuration tag "CXX" to libtool configure: creating ./config.status config.status: creating config.h [root@supplier-pre01 openssl]# make && make install ---------------------------------------------------------------------- Build complete. Don't forget to run 'make test'. Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/ 執行安裝後,會提示在某個目錄生成.so文件,我生成的位置在/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/ 打開php.ini,添加下面兩句話. vim /usr/local/php7/etc/php.ini extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/" extension=openssl.so